diff options
| author | Xinhui | 2017-08-31 17:35:50 +0200 |
|---|---|---|
| committer | Xinhui | 2017-08-31 17:43:19 +0200 |
| commit | 732375cb86150cc675e1c61556cd17160e35f564 (patch) | |
| tree | 50a06e9144b2200ee015d228842731b04b839774 /spec | |
| parent | c7ca08f191733293fc084abadc729cd3c224e120 (diff) | |
| parent | 26c4b71042d258da2fc9ccd67855219b9b012c6b (diff) | |
| download | chouette-core-732375cb86150cc675e1c61556cd17160e35f564.tar.bz2 | |
Merge branch 'master' into stif_netex_objectid
Diffstat (limited to 'spec')
84 files changed, 3384 insertions, 228 deletions
diff --git a/spec/concerns/configurable_spec.rb b/spec/concerns/configurable_spec.rb new file mode 100644 index 000000000..330241b72 --- /dev/null +++ b/spec/concerns/configurable_spec.rb @@ -0,0 +1,35 @@ +RSpec.describe Configurable do + + subject do + Class.new do + include Configurable + end + end + + let( :something ){ double('something') } + + it 'can be configured' do + expect{ subject.config.anything }.to raise_error(NoMethodError) + + subject.config.something = something + + expect( subject.config.something ).to eq(something) + # Instances delegate to the class + expect( subject.new.send(:config).something ).to eq(something) + # **All** instances delegate to the class + expect( subject.new.send(:config).something ).to eq(something) + end + + it 'can be configured with a block' do + + subject.config do | c | + c.something = something + end + + expect( subject.config.something ).to eq(something) + # Instances delegate to the class + expect( subject.new.send(:config).something ).to eq(something) + # **All** instances delegate to the class + expect( subject.new.send(:config).something ).to eq(something) + end +end diff --git a/spec/controllers/api/v1/iboo_controller_spec.rb b/spec/controllers/api/v1/iboo_controller_spec.rb new file mode 100644 index 000000000..64a929d1a --- /dev/null +++ b/spec/controllers/api/v1/iboo_controller_spec.rb @@ -0,0 +1,12 @@ +require 'rails_helper' + +RSpec.describe Api::V1::IbooController, type: :controller do + context '#authenticate' do + include_context 'iboo authenticated api user' + + it 'should set current organisation' do + controller.send(:authenticate) + expect(assigns(:current_organisation)).to eq api_key.organisation + end + end +end diff --git a/spec/controllers/api/v1/imports_controller_spec.rb b/spec/controllers/api/v1/imports_controller_spec.rb new file mode 100644 index 000000000..266b25486 --- /dev/null +++ b/spec/controllers/api/v1/imports_controller_spec.rb @@ -0,0 +1,38 @@ +require 'rails_helper' + +RSpec.describe Api::V1::ImportsController, type: :controller do + let(:workbench) { create :workbench, organisation: organisation } + + context 'unauthenticated' do + include_context 'iboo wrong authorisation api user' + + describe 'GET #index' do + it 'should not be successful' do + get :index, workbench_id: workbench.id + expect(response).not_to be_success + end + end + end + + context 'authenticated' do + include_context 'iboo authenticated api user' + + describe 'GET #index' do + it 'should be successful' do + get :index, workbench_id: workbench.id + expect(response).to be_success + end + end + + describe 'POST #create' do + let(:file) { fixture_file_upload('multiple_references_import.zip') } + + it 'should be successful' do + expect { + post :create, workbench_id: workbench.id, workbench_import: {file: file, creator: 'test'}, format: :json + }.to change{WorkbenchImport.count}.by(1) + expect(response).to be_success + end + end + end +end diff --git a/spec/controllers/api/v1/workbenches_controller_spec.rb b/spec/controllers/api/v1/workbenches_controller_spec.rb new file mode 100644 index 000000000..7780da142 --- /dev/null +++ b/spec/controllers/api/v1/workbenches_controller_spec.rb @@ -0,0 +1,25 @@ +require 'rails_helper' + +RSpec.describe Api::V1::WorkbenchesController, type: :controller do + context 'unauthenticated' do + include_context 'iboo wrong authorisation api user' + + describe 'GET #index' do + it 'should not be successful' do + get :index + expect(response).not_to be_success + end + end + end + + context 'authenticated' do + include_context 'iboo authenticated api user' + + describe 'GET #index' do + it 'should be successful' do + get :index + expect(response).to be_success + end + end + end +end diff --git a/spec/controllers/imports_controller_spec.rb b/spec/controllers/imports_controller_spec.rb index 7b575ab61..f07190496 100644 --- a/spec/controllers/imports_controller_spec.rb +++ b/spec/controllers/imports_controller_spec.rb @@ -15,6 +15,7 @@ RSpec.describe ImportsController, :type => :controller do it 'should be successful' do get :download, workbench_id: workbench.id, id: import.id, token: import.token_download expect(response).to be_success + expect( response.body ).to eq(import.file.read) end end end diff --git a/spec/decorators/api_key_decorator_spec.rb b/spec/decorators/api_key_decorator_spec.rb new file mode 100644 index 000000000..9451a3974 --- /dev/null +++ b/spec/decorators/api_key_decorator_spec.rb @@ -0,0 +1,4 @@ +require 'spec_helper' + +describe ApiKeyDecorator do +end diff --git a/spec/factories/api_keys.rb b/spec/factories/api_keys.rb new file mode 100644 index 000000000..963938c64 --- /dev/null +++ b/spec/factories/api_keys.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + factory :api_key, class: Api::V1::ApiKey do + name { SecureRandom.urlsafe_base64 } + token { "#{referential_id}-#{organisation_id}-#{SecureRandom.hex}" } + referential + organisation + end +end diff --git a/spec/factories/chouette_journey_pattern.rb b/spec/factories/chouette_journey_pattern.rb index 2ca9b5488..05d8d536a 100644 --- a/spec/factories/chouette_journey_pattern.rb +++ b/spec/factories/chouette_journey_pattern.rb @@ -6,7 +6,6 @@ FactoryGirl.define do sequence(:comment) { |n| "jp comment #{n}" } sequence(:registration_number) { |n| "jp registration_number #{n}" } sequence(:objectid) { |n| "organisation:JourneyPattern:lineId-#{n}:LOC" } - association :route, :factory => :route factory :journey_pattern do diff --git a/spec/factories/chouette_routes.rb b/spec/factories/chouette_routes.rb index 501d94da8..4986ab70e 100644 --- a/spec/factories/chouette_routes.rb +++ b/spec/factories/chouette_routes.rb @@ -18,6 +18,7 @@ FactoryGirl.define do after(:create) do |route, evaluator| create_list(:stop_point, evaluator.stop_points_count, route: route) + route.reload end factory :route_with_journey_patterns do diff --git a/spec/factories/chouette_time_table.rb b/spec/factories/chouette_time_table.rb index 0106395a5..a3ff63b2f 100644 --- a/spec/factories/chouette_time_table.rb +++ b/spec/factories/chouette_time_table.rb @@ -1,12 +1,4 @@ FactoryGirl.define do - - factory :time_table_date, :class => Chouette::TimeTableDate do - association :time_table, :factory => :time_table - end - - factory :time_table_period, :class => Chouette::TimeTablePeriod do - end - factory :time_table, :class => Chouette::TimeTable do sequence(:comment) { |n| "Timetable #{n}" } sequence(:objectid) { |n| "organisation:Timetable:#{n}:LOC" } diff --git a/spec/factories/chouette_time_table_dates.rb b/spec/factories/chouette_time_table_dates.rb new file mode 100644 index 000000000..62fdb3917 --- /dev/null +++ b/spec/factories/chouette_time_table_dates.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :time_table_date, class: Chouette::TimeTableDate do + association :time_table + end +end diff --git a/spec/factories/chouette_time_table_periods.rb b/spec/factories/chouette_time_table_periods.rb new file mode 100644 index 000000000..66640bbcc --- /dev/null +++ b/spec/factories/chouette_time_table_periods.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :time_table_period, class: Chouette::TimeTablePeriod do + association :time_table + period_start { Date.today } + period_end { Date.today + 1.month } + end +end diff --git a/spec/factories/chouette_vehicle_journey.rb b/spec/factories/chouette_vehicle_journey.rb index fa661de2e..5f64bd502 100644 --- a/spec/factories/chouette_vehicle_journey.rb +++ b/spec/factories/chouette_vehicle_journey.rb @@ -11,6 +11,7 @@ FactoryGirl.define do end factory :vehicle_journey do + association :company, factory: :company transient do stop_arrival_time '01:00:00' stop_departure_time '03:00:00' diff --git a/spec/factories/chouette_vehicle_journey_at_stop.rb b/spec/factories/chouette_vehicle_journey_at_stop.rb index c452a1317..831e347d4 100644 --- a/spec/factories/chouette_vehicle_journey_at_stop.rb +++ b/spec/factories/chouette_vehicle_journey_at_stop.rb @@ -1,8 +1,9 @@ FactoryGirl.define do - factory :vehicle_journey_at_stop, :class => Chouette::VehicleJourneyAtStop do association :vehicle_journey, :factory => :vehicle_journey + departure_day_offset { 0 } + departure_time { Time.now } + arrival_time { Time.now - 1.hour } end - end diff --git a/spec/factories/clean_up_results.rb b/spec/factories/clean_up_results.rb deleted file mode 100644 index 6d3818eff..000000000 --- a/spec/factories/clean_up_results.rb +++ /dev/null @@ -1,9 +0,0 @@ -FactoryGirl.define do - factory :clean_up_result do - criticity 1 -message_key "MyString" -message_attributs "" -cleanup nil - end - -end diff --git a/spec/factories/import_messages.rb b/spec/factories/import_messages.rb deleted file mode 100644 index 1101107d2..000000000 --- a/spec/factories/import_messages.rb +++ /dev/null @@ -1,11 +0,0 @@ -FactoryGirl.define do - factory :import_message do - criticity 1 - message_key "MyString" - message_attributs "" - import nil - resource nil - resource_attributes {} - end - -end diff --git a/spec/factories/import_tasks.rb b/spec/factories/import_tasks.rb deleted file mode 100644 index 9ca6db899..000000000 --- a/spec/factories/import_tasks.rb +++ /dev/null @@ -1,10 +0,0 @@ -FactoryGirl.define do - factory :import_task do |f| - user_name "dummy" - user_id 123 - no_save false - format "Neptune" - resources { Rack::Test::UploadedFile.new 'spec/fixtures/neptune.zip', 'application/zip', false } - referential { Referential.find_by_slug("first") } - end -end diff --git a/spec/factories/imports.rb b/spec/factories/imports.rb index fc8668606..2c53106c3 100644 --- a/spec/factories/imports.rb +++ b/spec/factories/imports.rb @@ -9,5 +9,10 @@ FactoryGirl.define do status :new started_at nil ended_at nil + creator 'rspec' + + after(:build) do |import| + import.class.skip_callback(:create, :before, :initialize_fields) + end end end diff --git a/spec/factories/netex_imports.rb b/spec/factories/netex_imports.rb new file mode 100644 index 000000000..057e47730 --- /dev/null +++ b/spec/factories/netex_imports.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :netex_import, class: NetexImport, parent: :import do + file { File.open(Rails.root.join('spec', 'fixtures', 'terminated_job.json')) } + end +end diff --git a/spec/factories/workbench_imports.rb b/spec/factories/workbench_imports.rb new file mode 100644 index 000000000..5cdcfd15f --- /dev/null +++ b/spec/factories/workbench_imports.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :workbench_import, class: WorkbenchImport, parent: :import do + file { File.open(Rails.root.join('spec', 'fixtures', 'terminated_job.json')) } + end +end diff --git a/spec/features/workbenches_spec.rb b/spec/features/workbenches_spec.rb index 9141b5673..536469a46 100644 --- a/spec/features/workbenches_spec.rb +++ b/spec/features/workbenches_spec.rb @@ -36,7 +36,7 @@ describe 'Workbenches', type: :feature do context 'without any filter' do it 'should have results' do - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to have_content(referential.name) expect(page).to have_content(other_referential.name) end @@ -45,7 +45,7 @@ describe 'Workbenches', type: :feature do context 'filter by organisation' do it 'should be possible to filter by organisation' do find("#q_organisation_name_eq_any_#{@user.organisation.name.parameterize.underscore}").set(true) - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to have_content(referential.name) expect(page).not_to have_content(other_referential.name) @@ -54,7 +54,7 @@ describe 'Workbenches', type: :feature do it 'should be possible to filter by multiple organisation' do find("#q_organisation_name_eq_any_#{@user.organisation.name.parameterize.underscore}").set(true) find("#q_organisation_name_eq_any_#{another_organisation.name.parameterize.underscore}").set(true) - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to have_content(referential.name) expect(page).to have_content(other_referential.name) @@ -63,7 +63,7 @@ describe 'Workbenches', type: :feature do it 'should keep filter value on submit' do box = "#q_organisation_name_eq_any_#{another_organisation.name.parameterize.underscore}" find(box).set(true) - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(find(box)).to be_checked end end @@ -73,7 +73,7 @@ describe 'Workbenches', type: :feature do other_referential.update_attribute(:archived_at, Date.today) find("#q_archived_at_not_null").set(true) - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to have_content(other_referential.name) expect(page).to_not have_content(referential.name) end @@ -83,7 +83,7 @@ describe 'Workbenches', type: :feature do find("#q_archived_at_not_null").set(true) find("#q_archived_at_null").set(true) - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to have_content(referential.name) expect(page).to have_content(other_referential.name) end @@ -92,14 +92,14 @@ describe 'Workbenches', type: :feature do other_referential.update_attribute(:archived_at, Date.today) find("#q_archived_at_null").set(true) - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to have_content(referential.name) expect(page).to_not have_content(other_referential.name) end it 'should keep filter value on submit' do find("#q_archived_at_null").set(true) - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(find("#q_archived_at_null")).to be_checked end end @@ -115,7 +115,7 @@ describe 'Workbenches', type: :feature do dates = referential.validity_period.to_a fill_validity_field dates[0], 'begin_gteq' fill_validity_field dates[1], 'end_lteq' - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to have_content(referential.name) expect(page).to_not have_content(other_referential.name) @@ -125,7 +125,7 @@ describe 'Workbenches', type: :feature do dates = referential.validity_period.to_a fill_validity_field dates[0], 'begin_gteq' fill_validity_field dates[1], 'end_lteq' - click_button 'Filtrer' + click_button I18n.t('actions.filter') find('a[href*="&sort=validity_period"]').click @@ -136,7 +136,7 @@ describe 'Workbenches', type: :feature do it 'should not show results for out off range' do fill_validity_field(Date.today - 2.year, 'begin_gteq') fill_validity_field(Date.today - 1.year, 'end_lteq') - click_button 'Filtrer' + click_button I18n.t('actions.filter') expect(page).to_not have_content(referential.name) expect(page).to_not have_content(other_referential.name) @@ -147,7 +147,7 @@ describe 'Workbenches', type: :feature do ['begin_gteq', 'end_lteq'].each_with_index do |field, index| fill_validity_field dates[index], field end - click_button 'Filtrer' + click_button I18n.t('actions.filter') ['begin_gteq', 'end_lteq'].each_with_index do |field, index| expect(find("#q_validity_period_#{field}_3i").value).to eq dates[index].day.to_s diff --git a/spec/fixtures/OFFRE_TRANSDEV_2017030112251.zip b/spec/fixtures/OFFRE_TRANSDEV_2017030112251.zip Binary files differnew file mode 100644 index 000000000..566cc5b0b --- /dev/null +++ b/spec/fixtures/OFFRE_TRANSDEV_2017030112251.zip diff --git a/spec/fixtures/multiple_references_import.zip b/spec/fixtures/multiple_references_import.zip Binary files differnew file mode 100644 index 000000000..28ddff198 --- /dev/null +++ b/spec/fixtures/multiple_references_import.zip diff --git a/spec/fixtures/neptune.zip b/spec/fixtures/neptune.zip Binary files differdeleted file mode 100644 index 86b688b51..000000000 --- a/spec/fixtures/neptune.zip +++ /dev/null diff --git a/spec/fixtures/nozip.zip b/spec/fixtures/nozip.zip new file mode 100644 index 000000000..505bd213a --- /dev/null +++ b/spec/fixtures/nozip.zip @@ -0,0 +1 @@ +no zip file diff --git a/spec/fixtures/single_reference_import.zip b/spec/fixtures/single_reference_import.zip Binary files differnew file mode 100644 index 000000000..37a516f69 --- /dev/null +++ b/spec/fixtures/single_reference_import.zip diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/calendriers.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/calendriers.xml new file mode 100644 index 000000000..bfbd0aea1 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/calendriers.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:ValidBetween> + <netex:FromDate>2017-03-01</netex:FromDate> + <netex:ToDate>2017-03-31</netex:ToDate> + </netex:ValidBetween> + <netex:members> + <netex:dayTypes> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any" > + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any" > + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any" > + <netex:Name>Service spĂ©cial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any" > + <netex:Name>Restriction</netex:Name> + </netex:DayType> + </netex:dayTypes> + <netex:dayTypeAssignments> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + </netex:dayTypeAssignments> + <netex:operatingPeriods> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any" > + <netex:FromDate>2017-01-01</netex:FromDate> + <netex:ToDate>2017-12-31</netex:ToDate> + </netex:OperatingPeriod> + </netex:operatingPeriods> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/commun.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/commun.xml new file mode 100644 index 000000000..266c8a598 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/commun.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + <netex:notices> + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + </netex:notices> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml new file mode 100644 index 000000000..832793036 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ </netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par lĂ </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml new file mode 100644 index 000000000..9dff0d850 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ aussi</netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par lĂ itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/calendriers.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/calendriers.xml new file mode 100644 index 000000000..1043e0cde --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/calendriers.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" version="any"> + <netex:ValidBetween> + <netex:FromDate>2017-04-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:ValidBetween> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:members> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any"> + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any"> + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any"> + <netex:Name>Service spĂ©cial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any"> + <netex:Name>Restriction</netex:Name> + </netex:DayType> + <netex:DayTypeAssignment id="dta1" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta2" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta3" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta4" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any"> + <netex:FromDate>2017-01-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:OperatingPeriod> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/commun.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/commun.xml new file mode 100644 index 000000000..f59f8ac2d --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/commun.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml new file mode 100644 index 000000000..9eefeeb43 --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ </netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par lĂ </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml new file mode 100644 index 000000000..d260ef17e --- /dev/null +++ b/spec/fixtures/source_OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ aussi</netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par lĂ itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/calendriers.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/calendriers.xml new file mode 100644 index 000000000..bfbd0aea1 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/calendriers.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:ValidBetween> + <netex:FromDate>2017-03-01</netex:FromDate> + <netex:ToDate>2017-03-31</netex:ToDate> + </netex:ValidBetween> + <netex:members> + <netex:dayTypes> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any" > + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any" > + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any" > + <netex:Name>Service spĂ©cial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any" > + <netex:Name>Restriction</netex:Name> + </netex:DayType> + </netex:dayTypes> + <netex:dayTypeAssignments> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment version="any" > + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + </netex:dayTypeAssignments> + <netex:operatingPeriods> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any" > + <netex:FromDate>2017-01-01</netex:FromDate> + <netex:ToDate>2017-12-31</netex:ToDate> + </netex:OperatingPeriod> + </netex:operatingPeriods> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/commun.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/commun.xml new file mode 100644 index 000000000..266c8a598 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/commun.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:netex="http://www.netex.org.uk/netex" + xmlns:siri="http://www.siri.org.uk/siri" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + <netex:notices> + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef>ServiceJourneyNotice</netex:TypeOfNoticeRef> + </netex:Notice> + </netex:notices> + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml new file mode 100644 index 000000000..832793036 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ </netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par lĂ </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml new file mode 100644 index 000000000..9dff0d850 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" + xmlns:netex="http://www.netex.org.uk/netex" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + <netex:routes> + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + </netex:routes> + <netex:directions> + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ aussi</netex:Name> + </netex:Direction> + </netex:directions> + <netex:serviceJourneyPatterns> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" + version="any"> + <netex:Name>Par lĂ itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" + version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern + id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + </netex:serviceJourneyPatterns> + <netex:destinationDisplays> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" + version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" + version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + </netex:destinationDisplays> + <netex:scheduledStopPoints> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" + version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" + version="any"/> + </netex:scheduledStopPoints> + <netex:passengerStopAssignments> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment + id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any"> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + </netex:passengerStopAssignments> + <netex:routingConstraintZones> + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" + version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef + ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + </netex:routingConstraintZones> + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" + version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + <netex:serviceJourneys> + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> + version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> + version="any"</netex:DayTypeRef> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" + version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + </netex:serviceJourneys> + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/calendriers.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/calendriers.xml new file mode 100644 index 000000000..1043e0cde --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/calendriers.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_CALENDRIER-1_20170214090012:LOC" version="any"> + <netex:ValidBetween> + <netex:FromDate>2017-04-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:ValidBetween> + <netex:TypeOfFrameRef ref="NETEX_CALENDRIER"/> + <netex:members> + <netex:DayType id="CITYWAY:DayType:1:LOC" version="any"> + <netex:Name>Semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Monday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Tuesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Wednesday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Thursday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Friday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:2:LOC" version="any"> + <netex:Name>Fin de semaine</netex:Name> + <netex:properties> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Saturday</netex:DaysOfWeek> + </netex:PropertyOfDay> + <netex:PropertyOfDay> + <netex:DaysOfWeek>Sunday</netex:DaysOfWeek> + </netex:PropertyOfDay> + </netex:properties> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:3:LOC" version="any"> + <netex:Name>Service spĂ©cial</netex:Name> + </netex:DayType> + <netex:DayType id="CITYWAY:DayType:4:LOC" version="any"> + <netex:Name>Restriction</netex:Name> + </netex:DayType> + <netex:DayTypeAssignment id="dta1" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta2" version="any" order="0"> + <netex:OperatingPeriodRef ref="CITYWAY:OperatingPeriod:1:LOC" version="any"/> + <netex:DayTypeRef ref="CITYWAY:DayType:2:LOC" version="any"/> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta3" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:3:LOC" version="any"/> + <netex:isAvailable>true</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:DayTypeAssignment id="dta4" version="any" order="0"> + <netex:Date>2017-03-15</netex:Date> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC" version="any"/> + <netex:isAvailable>false</netex:isAvailable> + </netex:DayTypeAssignment> + <netex:OperatingPeriod id="CITYWAY:OperatingPeriod:1:LOC" version="any"> + <netex:FromDate>2017-01-01T00:00:00</netex:FromDate> + <netex:ToDate>2017-12-31T00:00:00</netex:ToDate> + </netex:OperatingPeriod> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/commun.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/commun.xml new file mode 100644 index 000000000..f59f8ac2d --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/commun.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:gml="http://www.opengis.net/gml/3.2" + xmlns:core="http://www.govtalk.gov.uk/core" xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_COMMUN-1_20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_COMMUN"/> + <netex:members> + + <netex:Notice id="CITYWAY:Notice:1:LOC" version="any"> + <netex:Text>Notice 1</netex:Text> + <netex:PublicCode>1</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:2:LOC" version="any"> + <netex:Text>Notice 2</netex:Text> + <netex:PublicCode>2</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + <netex:Notice id="CITYWAY:Notice:3:LOC" version="any"> + <netex:Text>Notice 3</netex:Text> + <netex:PublicCode>3</netex:PublicCode> + <netex:TypeOfNoticeRef ref="ServiceJourneyNotice"/> + </netex:Notice> + + </netex:members> + </netex:GeneralFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml new file mode 100644 index 000000000..9eefeeb43 --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00108">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ </netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par lĂ </netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009052:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50009053:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:1:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:011"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:01:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:01:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>01:05:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>01:05:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml new file mode 100644 index 000000000..d260ef17e --- /dev/null +++ b/spec/fixtures/target/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netex:PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.netex.org.uk/netex ../../xsd/NeTEx_publication.xsd" xmlns:netex="http://www.netex.org.uk/netex" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" + xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:core="http://www.govtalk.gov.uk/core" + xmlns:siri="http://www.siri.org.uk/siri" version="1.0"> + <netex:PublicationTimestamp>2017-02-14T09:13:51.0</netex:PublicationTimestamp> + <netex:ParticipantRef>CITYWAY</netex:ParticipantRef> + <netex:dataObjects> + <netex:CompositeFrame id="CITYWAY:CompositeFrame:NETEX_OFFRE_LIGNE-1:LOC" version="any"> + <netex:Name>Ligne 1</netex:Name> + <netex:TypeOfFrameRef ref="NETEX_OFFRE_LIGNE"/> + <netex:frames> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_STRUCTURE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_STRUCTURE"/> + <netex:members> + + <netex:Route id="CITYWAY:Route:1:LOC" version="any"> + <netex:Name>route 1</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>outbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:1:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + </netex:Route> + <netex:Route id="CITYWAY:Route:2:LOC" version="any"> + <netex:Name>route 2</netex:Name> + <netex:LineRef ref="STIF:CODIFLIGNE:Line:C00109">version="any"</netex:LineRef> + <netex:DirectionType>inbound</netex:DirectionType> + <netex:DirectionRef ref="CITYWAY:Direction:2:LOC" version="any"/> + <netex:InverseRouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + </netex:Route> + + + <netex:Direction id="CITYWAY:Direction:1:LOC" version="any"> + <netex:Name>Par ici aussi</netex:Name> + </netex:Direction> + <netex:Direction id="CITYWAY:Direction:2:LOC" version="any"> + <netex:Name>Par lĂ aussi</netex:Name> + </netex:Direction> + + + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"> + <netex:Name>Par ici itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:1:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:1:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:1-1-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + <netex:ServiceJourneyPattern id="CITYWAY:ServiceJourneyPattern:2:LOC" version="any"> + <netex:Name>Par lĂ itou</netex:Name> + <netex:RouteRef ref="CITYWAY:Route:2:LOC" version="any"/> + <netex:DestinationDisplayRef ref="CITYWAY:DestinationDisplay:2:LOC" version="any"/> + <netex:pointsInSequence> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-1:LOC" order="1" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + <netex:StopPointInJourneyPattern id="CITYWAY:StopPointInJourneyPattern:2-2-2:LOC" order="2" + version="any"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:ForAlighting>true</netex:ForAlighting> + <netex:ForBoarding>true</netex:ForBoarding> + </netex:StopPointInJourneyPattern> + </netex:pointsInSequence> + <netex:ServiceJourneyPatternType>passenger</netex:ServiceJourneyPatternType> + </netex:ServiceJourneyPattern> + + + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:1:LOC" version="any"> + <netex:FrontText>Mission 1 bis</netex:FrontText> + <netex:PublicCode>1234</netex:PublicCode> + </netex:DestinationDisplay> + <netex:DestinationDisplay id="CITYWAY:DestinationDisplay:2:LOC" version="any"> + <netex:FrontText>Mission 2 bis</netex:FrontText> + <netex:PublicCode>2345</netex:PublicCode> + </netex:DestinationDisplay> + + + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:ScheduledStopPoint id="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + + + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094817:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-1:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-1:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000918:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:1-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78402:ZDE:50000917:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + <netex:PassengerStopAssignment id="CITYWAY:PassengerStopAssignment:2-2:LOC" version="any" order="0"> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:2-2:LOC" version="any"/> + <netex:QuayRef ref="FR:78217:ZDE:50094816:STIF">version="any"</netex:QuayRef> + </netex:PassengerStopAssignment> + + + <netex:RoutingConstraintZone id="CITYWAY:RoutingConstraintZone:1:LOC" version="any"> + <netex:Name>ITL 1</netex:Name> + <netex:members> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-1:LOC" version="any"/> + <netex:ScheduledStopPointRef ref="CITYWAY:ScheduledStopPoint:1-2:LOC" version="any"/> + </netex:members> + <netex:ZoneUse>cannotBoardAndAlightInSameZone</netex:ZoneUse> + </netex:RoutingConstraintZone> + + </netex:members> + </netex:GeneralFrame> + <netex:GeneralFrame id="CITYWAY:GeneralFrame:NETEX_HORAIRE-20170214090012:LOC" version="any"> + <netex:TypeOfFrameRef ref="NETEX_HORAIRE"/> + <netex:members> + + <netex:ServiceJourney id="CITYWAY:ServiceJourney:1-1:LOC" version="any"> + <netex:Name>Course 1 par ici aussi</netex:Name> + <netex:noticeAssignments> + <netex:NoticeAssignment id="ns1" version="any" order="0"> + <netex:NoticeRef ref="CITYWAY:Notice:2:LOC"> + version="any"</netex:NoticeRef> + </netex:NoticeAssignment> + </netex:noticeAssignments> + <netex:dayTypes> + <netex:DayTypeRef ref="CITYWAY:DayType:1:LOC"> version="any"</netex:DayTypeRef> + <netex:DayTypeRef ref="CITYWAY:DayType:4:LOC"> version="any"</netex:DayTypeRef> + </netex:dayTypes> + <netex:JourneyPatternRef ref="CITYWAY:ServiceJourneyPattern:1:LOC" version="any"/> + <netex:OperatorRef ref="STIF:CODIFLIGNE:Operator:212"> + version="any"</netex:OperatorRef> + <netex:trainNumbers> + <netex:TrainNumberRef ref="CITYWAY:TrainNumber:1234:LOC">version="any"</netex:TrainNumberRef> + </netex:trainNumbers> + <netex:passingTimes> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>23:58:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>0</netex:ArrivalDayOffset> + <netex:DepartureTime>23:59:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>0</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + <netex:TimetabledPassingTime version="any"> + <netex:ArrivalTime>00:03:00.000</netex:ArrivalTime> + <netex:ArrivalDayOffset>1</netex:ArrivalDayOffset> + <netex:DepartureTime>00:04:00.000</netex:DepartureTime> + <netex:DepartureDayOffset>1</netex:DepartureDayOffset> + </netex:TimetabledPassingTime> + </netex:passingTimes> + </netex:ServiceJourney> + + </netex:members> + </netex:GeneralFrame> + </netex:frames> + </netex:CompositeFrame> + </netex:dataObjects> +</netex:PublicationDelivery> diff --git a/spec/javascripts/itineraries/reducers/stop_points_spec.js b/spec/javascripts/itineraries/reducers/stop_points_spec.js index 93fe85d36..0331a424c 100644 --- a/spec/javascripts/itineraries/reducers/stop_points_spec.js +++ b/spec/javascripts/itineraries/reducers/stop_points_spec.js @@ -16,6 +16,7 @@ describe('stops reducer', () => { { text: 'first', index: 0, + stoppoint_id: 72, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -27,6 +28,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -54,6 +56,7 @@ describe('stops reducer', () => { { text: 'first', index: 0, + stoppoint_id: 72, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -65,6 +68,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -99,6 +103,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 72, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -110,6 +115,7 @@ describe('stops reducer', () => { { text: 'first', index: 0, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -133,6 +139,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 72, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -144,6 +151,7 @@ describe('stops reducer', () => { { text: 'first', index: 0, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -156,28 +164,29 @@ describe('stops reducer', () => { ) }) - it('should handle DELETE_STOP', () => { - expect( - stopPointsReducer(state, { - type: 'DELETE_STOP', - index: 1 - }) - ).toEqual( - [ - { - text: 'first', - index: 0, - edit: false, - for_boarding: 'normal', - for_alighting: 'normal', - olMap: { - isOpened: false, - json: {} - } - } - ] - ) - }) + // it('should handle DELETE_STOP', () => { + // expect( + // stopPointsReducer(state, { + // type: 'DELETE_STOP', + // index: 1 + // }) + // ).toEqual( + // [ + // { + // text: 'first', + // index: 0, + // stoppoint_id: 72, + // edit: false, + // for_boarding: 'normal', + // for_alighting: 'normal', + // olMap: { + // isOpened: false, + // json: {} + // } + // } + // ] + // ) + // }) it('should handle UPDATE_INPUT_VALUE', () => { expect( @@ -205,8 +214,8 @@ describe('stops reducer', () => { text: 'new value', name: 'new', index: 0, + stoppoint_id: 72, edit: false, - stoppoint_id: '', stoparea_id: 1, for_boarding: 'normal', for_alighting: 'normal', @@ -226,6 +235,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -251,6 +261,7 @@ describe('stops reducer', () => { { text: 'first', index: 0, + stoppoint_id: 72, edit: false, for_boarding: 'prohibited', for_alighting: 'normal', @@ -262,6 +273,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -285,6 +297,7 @@ describe('stops reducer', () => { { text: 'first', index: 0, + stoppoint_id: 72, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -293,6 +306,7 @@ describe('stops reducer', () => { json: { text: 'first', index: 0, + stoppoint_id: 72, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -303,6 +317,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', @@ -326,6 +341,7 @@ describe('stops reducer', () => { { text: 'first', index: 0, + stoppoint_id: 72, edit: true, for_boarding: 'normal', for_alighting: 'normal', @@ -337,6 +353,7 @@ describe('stops reducer', () => { { text: 'second', index: 1, + stoppoint_id: 73, edit: false, for_boarding: 'normal', for_alighting: 'normal', diff --git a/spec/javascripts/time_table/actions_spec.js b/spec/javascripts/time_table/actions_spec.js index ebd1bb04c..f052aeece 100644 --- a/spec/javascripts/time_table/actions_spec.js +++ b/spec/javascripts/time_table/actions_spec.js @@ -158,33 +158,41 @@ describe('actions', () => { let modalProps = {} let timeTablePeriods = [] let metas = {} + let timetableInDates = [] + let error = '' const expectedAction = { type: 'VALIDATE_PERIOD_FORM', modalProps, timeTablePeriods, - metas + metas, + timetableInDates, + error } - expect(actions.validatePeriodForm(modalProps, timeTablePeriods, metas)).toEqual(expectedAction) + expect(actions.validatePeriodForm(modalProps, timeTablePeriods, metas, timetableInDates, error)).toEqual(expectedAction) }) it('should create an action to include date in period', () => { let index = 1 + let date = actions.formatDate(new Date) const expectedAction = { type: 'INCLUDE_DATE_IN_PERIOD', index, - dayTypes + dayTypes, + date } - expect(actions.includeDateInPeriod(index, dayTypes)).toEqual(expectedAction) + expect(actions.includeDateInPeriod(index, dayTypes, date)).toEqual(expectedAction) }) it('should create an action to exclude date from period', () => { let index = 1 + let date = actions.formatDate(new Date) const expectedAction = { type: 'EXCLUDE_DATE_FROM_PERIOD', index, - dayTypes + dayTypes, + date } - expect(actions.excludeDateFromPeriod(index, dayTypes)).toEqual(expectedAction) + expect(actions.excludeDateFromPeriod(index, dayTypes, date)).toEqual(expectedAction) }) it('should create an action to open confirm modal', () => { diff --git a/spec/javascripts/time_table/reducers/modal_spec.js b/spec/javascripts/time_table/reducers/modal_spec.js index 4246027b8..570eb85ed 100644 --- a/spec/javascripts/time_table/reducers/modal_spec.js +++ b/spec/javascripts/time_table/reducers/modal_spec.js @@ -154,7 +154,7 @@ describe('modal reducer', () => { error: '' } let newModalProps = { - active: false, + active: true, begin: { day: '01', month: '01', @@ -170,12 +170,15 @@ describe('modal reducer', () => { } let ttperiods = [] + let ttdates = [] expect( modalReducer(state, { type: 'VALIDATE_PERIOD_FORM', modalProps : modProps, - timeTablePeriods: ttperiods + timeTablePeriods: ttperiods, + timetableInDates: ttdates, + error: 'La date de dĂ©part doit ĂȘtre antĂ©rieure Ă la date de fin' }) ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) }) @@ -222,6 +225,8 @@ describe('modal reducer', () => { {id: 265, period_start: '2017-05-14', period_end: '2017-05-24'} ] + let ttdates2 = [] + let newModalProps2 = { active: true, begin: { @@ -242,8 +247,76 @@ describe('modal reducer', () => { modalReducer(state2, { type: 'VALIDATE_PERIOD_FORM', modalProps : modProps2, - timeTablePeriods: ttperiods2 + timeTablePeriods: ttperiods2, + timetableInDates: ttdates2, + error: "Les pĂ©riodes ne peuvent pas se chevaucher" }) ).toEqual(Object.assign({}, state2, {modalProps: newModalProps2})) }) + + it('should handle VALIDATE_PERIOD_FORM and throw error if period overlaps date', () => { + let state3 = { + confirmModal: {}, + modalProps: { + active: false, + begin: { + day: '01', + month: '08', + year: '2017' + }, + end: { + day: '09', + month: '08', + year: '2017' + }, + index: false, + error: '' + }, + type: '' + } + let modProps3 = { + active: true, + begin: { + day: '01', + month: '08', + year: '2017' + }, + end: { + day: '09', + month: '08', + year: '2017' + }, + index: false, + error: '' + } + let ttperiods3 = [] + + let ttdates3 = [{date: "2017-08-04", include_date: true}] + + let newModalProps3 = { + active: true, + begin: { + day: '01', + month: '08', + year: '2017' + }, + end: { + day: '09', + month: '08', + year: '2017' + }, + index: false, + error: "Une pĂ©riode ne peut chevaucher une date dans un calendrier" + } + + expect( + modalReducer(state3, { + type: 'VALIDATE_PERIOD_FORM', + modalProps : modProps3, + timeTablePeriods: ttperiods3, + timetableInDates: ttdates3, + error: "Une pĂ©riode ne peut chevaucher une date dans un calendrier" + }) + ).toEqual(Object.assign({}, state3, {modalProps: newModalProps3})) + }) }) diff --git a/spec/javascripts/time_table/reducers/timetable_spec.js b/spec/javascripts/time_table/reducers/timetable_spec.js index 0b418a52e..6585a78a0 100644 --- a/spec/javascripts/time_table/reducers/timetable_spec.js +++ b/spec/javascripts/time_table/reducers/timetable_spec.js @@ -12,12 +12,15 @@ let current_month = [{"day":"lundi","date":"2017-05-01","wday":1,"wnumber":"18", let newCurrentMonth = [{"day":"lundi","date":"2017-05-01","wday":1,"wnumber":"18","mday":1,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-02","wday":2,"wnumber":"18","mday":2,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-03","wday":3,"wnumber":"18","mday":3,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-04","wday":4,"wnumber":"18","mday":4,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"vendredi","date":"2017-05-05","wday":5,"wnumber":"18","mday":5,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-06","wday":6,"wnumber":"18","mday":6,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-07","wday":0,"wnumber":"18","mday":7,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"lundi","date":"2017-05-08","wday":1,"wnumber":"19","mday":8,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mardi","date":"2017-05-09","wday":2,"wnumber":"19","mday":9,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mercredi","date":"2017-05-10","wday":3,"wnumber":"19","mday":10,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"jeudi","date":"2017-05-11","wday":4,"wnumber":"19","mday":11,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"vendredi","date":"2017-05-12","wday":5,"wnumber":"19","mday":12,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-13","wday":6,"wnumber":"19","mday":13,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-14","wday":0,"wnumber":"19","mday":14,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"lundi","date":"2017-05-15","wday":1,"wnumber":"20","mday":15,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-16","wday":2,"wnumber":"20","mday":16,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-17","wday":3,"wnumber":"20","mday":17,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-18","wday":4,"wnumber":"20","mday":18,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"vendredi","date":"2017-05-19","wday":5,"wnumber":"20","mday":19,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"samedi","date":"2017-05-20","wday":6,"wnumber":"20","mday":20,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"dimanche","date":"2017-05-21","wday":0,"wnumber":"20","mday":21,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"lundi","date":"2017-05-22","wday":1,"wnumber":"21","mday":22,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-23","wday":2,"wnumber":"21","mday":23,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-24","wday":3,"wnumber":"21","mday":24,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-25","wday":4,"wnumber":"21","mday":25,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"vendredi","date":"2017-05-26","wday":5,"wnumber":"21","mday":26,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-27","wday":6,"wnumber":"21","mday":27,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-28","wday":0,"wnumber":"21","mday":28,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"lundi","date":"2017-05-29","wday":1,"wnumber":"22","mday":29,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mardi","date":"2017-05-30","wday":2,"wnumber":"22","mday":30,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mercredi","date":"2017-05-31","wday":3,"wnumber":"22","mday":31,"include_date":false,"excluded_date":false,"in_periods":false}] +let time_table_dates = [] + let json = { current_month: current_month, current_periode_range: current_periode_range, periode_range: periode_range, time_table_periods: time_table_periods, - day_types: strDayTypes + day_types: strDayTypes, + time_table_dates: time_table_dates } describe('timetable reducer with empty state', () => { @@ -26,7 +29,8 @@ describe('timetable reducer with empty state', () => { current_month: [], current_periode_range: "", periode_range: [], - time_table_periods: [] + time_table_periods: [], + time_table_dates: [] } }) @@ -42,6 +46,7 @@ describe('timetable reducer with empty state', () => { current_periode_range: current_periode_range, periode_range: periode_range, time_table_periods: time_table_periods, + time_table_dates: time_table_dates } expect( timetableReducer(state, { @@ -59,6 +64,7 @@ describe('timetable reducer with filled state', () => { current_periode_range: current_periode_range, periode_range: periode_range, time_table_periods: time_table_periods, + time_table_dates: time_table_dates } }) @@ -130,45 +136,92 @@ describe('timetable reducer with filled state', () => { ).toEqual(state) }) - it('should handle INCLUDE_DATE_IN_PERIOD', () => { + it('should handle INCLUDE_DATE_IN_PERIOD and add in_day if TT doesnt have it', () => { + let newDates = state.time_table_dates.concat({date: "2017-05-05", in_out: true}) + let newState = Object.assign({}, state, {time_table_dates: newDates}) state.current_month[4].include_date = true expect( timetableReducer(state, { type: 'INCLUDE_DATE_IN_PERIOD', index: 4, - dayTypes: arrDayTypes + dayTypes: arrDayTypes, + date: "2017-05-05" }) - ).toEqual(state) + ).toEqual(newState) + }) + + it('should handle INCLUDE_DATE_IN_PERIOD and remove in_day if TT has it', () => { + state.current_month[4].include_date = true + state.time_table_dates.push({date: "2017-05-05", in_out: true}) + let newState = Object.assign({}, state, {time_table_dates: []}) + expect( + timetableReducer(state, { + type: 'INCLUDE_DATE_IN_PERIOD', + index: 4, + dayTypes: arrDayTypes, + date: "2017-05-05" + }) + ).toEqual(newState) }) - it('should handle EXCLUDE_DATE_FROM_PERIOD', () => { + it('should handle EXCLUDE_DATE_FROM_PERIOD and add out_day if TT doesnt have it', () => { + let newDates = state.time_table_dates.concat({date: "2017-05-01", in_out: false}) + let newState = Object.assign({}, state, {time_table_dates: newDates}) state.current_month[0].excluded_date = true expect( timetableReducer(state, { type: 'EXCLUDE_DATE_FROM_PERIOD', index: 0, - dayTypes: arrDayTypes + dayTypes: arrDayTypes, + date: "2017-05-01" }) - ).toEqual(state) + ).toEqual(newState) }) - it('should handle VALIDATE_PERIOD_FORM', () => { - state.current_month[13].in_periods = false - state.time_table_periods[4].period_start = '2017-05-15' + it('should handle EXCLUDE_DATE_FROM_PERIOD and remove out_day if TT has it', () => { + state.time_table_dates = [{date: "2017-05-01", in_out: false}] + state.current_month[0].excluded_date = true + let newState = Object.assign({}, state, {time_table_dates: []}) + expect( + timetableReducer(state, { + type: 'EXCLUDE_DATE_FROM_PERIOD', + index: 0, + dayTypes: arrDayTypes, + date: "2017-05-01" + }) + ).toEqual(newState) + }) + + it('should handle UPDATE_DAY_TYPES and remove out_day that are out of day types', () => { + state.time_table_dates = [{date: "2017-05-01", in_out: false}] + let newArrDayTypes = arrDayTypes.slice(0) + newArrDayTypes[1] = false + let newState = Object.assign({}, state, {time_table_dates: []}) + expect( + timetableReducer(state, { + type: 'UPDATE_DAY_TYPES', + dayTypes: newArrDayTypes + }).time_table_dates + ).toEqual([]) + }) + + it('should handle VALIDATE_PERIOD_FORM and add period if modalProps index = false', () => { + let newPeriods = state.time_table_periods.concat({"period_start": "2018-05-15", "period_end": "2018-05-24"}) + let newState = Object.assign({}, state, {time_table_periods: newPeriods}) let modalProps = { active: false, begin: { day: '15', month: '05', - year: '2017' + year: '2018' }, end: { day: '24', month: '05', - year: '2017' + year: '2018' }, error: '', - index: 4 + index: false } expect( timetableReducer(state, { @@ -177,8 +230,10 @@ describe('timetable reducer with filled state', () => { timeTablePeriods: state.time_table_periods, metas: { day_types: arrDayTypes - } + }, + timetableInDates: state.time_table_dates.filter(d => d.in_out == true), + error: modalProps.error }) - ).toEqual(state) + ).toEqual(newState) }) }) diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js index d96baf8ef..707ae22cb 100644 --- a/spec/javascripts/vehicle_journeys/actions_spec.js +++ b/spec/javascripts/vehicle_journeys/actions_spec.js @@ -165,12 +165,12 @@ describe('when updating vjas time', () => { }) describe('when clicking on validate button inside shifting modal', () => { it('should create an action to shift a vehiclejourney schedule', () => { - const data = {} + const addtionalTime = 0 const expectedAction = { type: 'SHIFT_VEHICLEJOURNEY', - data + addtionalTime } - expect(actions.shiftVehicleJourney(data)).toEqual(expectedAction) + expect(actions.shiftVehicleJourney(addtionalTime)).toEqual(expectedAction) }) }) describe('when clicking on validate button inside editing modal', () => { @@ -187,14 +187,16 @@ describe('when clicking on validate button inside editing modal', () => { }) describe('when clicking on validate button inside duplicating modal', () => { it('should create an action to duplicate a vehiclejourney schedule', () => { - const data = {} + const addtionalTime = 0 const departureDelta = 0 + const duplicateNumber = 1 const expectedAction = { type: 'DUPLICATE_VEHICLEJOURNEY', - data, + addtionalTime, + duplicateNumber, departureDelta } - expect(actions.duplicateVehicleJourney(data, departureDelta)).toEqual(expectedAction) + expect(actions.duplicateVehicleJourney(addtionalTime, duplicateNumber, departureDelta)).toEqual(expectedAction) }) }) describe('when clicking on edit notes modal', () => { @@ -432,3 +434,16 @@ describe('when using select2 to pick a company', () => { expect(actions.select2Company(selectedCompany)).toEqual(expectedAction) }) }) +describe('when using select2 to unselect a company', () => { + it('should create an action to unselect a company inside modal', () => { + let selectedCompany = { + id: 1, + objectid: 2, + name: 'test', + } + const expectedAction = { + type: 'UNSELECT_CP_EDIT_MODAL' + } + expect(actions.unselect2Company()).toEqual(expectedAction) + }) +}) diff --git a/spec/javascripts/vehicle_journeys/reducers/modal_spec.js b/spec/javascripts/vehicle_journeys/reducers/modal_spec.js index c016812da..4530b5ee7 100644 --- a/spec/javascripts/vehicle_journeys/reducers/modal_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/modal_spec.js @@ -167,4 +167,13 @@ describe('modal reducer', () => { }) ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) }) + + it('should handle UNSELECT_CP_EDIT_MODAL', () => { + let newModalProps = {selectedCompany : undefined} + expect( + modalReducer(state, { + type: 'UNSELECT_CP_EDIT_MODAL' + }) + ).toEqual(Object.assign({}, state, {modalProps: newModalProps})) + }) }) diff --git a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js index 620e2ffdd..3b2137a2a 100644 --- a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js @@ -198,15 +198,12 @@ describe('vehicleJourneys reducer', () => { }, stop_area_object_id : "FR:92024:ZDE:420553:STIF" }] - let fakeData = { - objectid: {value : '11'}, - additional_time: {value: '5'} - } + let addtionalTime = 5 let newVJ = Object.assign({}, state[0], {vehicle_journey_at_stops: newVJAS}) expect( vjReducer(state, { type: 'SHIFT_VEHICLEJOURNEY', - data: fakeData + addtionalTime }) ).toEqual([newVJ, state[1]]) }) @@ -225,17 +222,17 @@ describe('vehicleJourneys reducer', () => { stop_area_object_id : "FR:92024:ZDE:420553:STIF" }] let departureDelta = 1 - let fakeData = { - duplicate_number: {value : 1}, - additional_time: {value: '5'} - } + let addtionalTime = 5 + let duplicateNumber = 1 + let newVJ = Object.assign({}, state[0], {vehicle_journey_at_stops: newVJAS, selected: false}) newVJ.published_journey_name = state[0].published_journey_name + '-0' delete newVJ['objectid'] expect( vjReducer(state, { type: 'DUPLICATE_VEHICLEJOURNEY', - data: fakeData, + addtionalTime, + duplicateNumber, departureDelta }) ).toEqual([state[0], newVJ, state[1]]) diff --git a/spec/lib/result_spec.rb b/spec/lib/result_spec.rb new file mode 100644 index 000000000..949de163c --- /dev/null +++ b/spec/lib/result_spec.rb @@ -0,0 +1,20 @@ +RSpec.describe Result do + + context 'is a wrapper of a value' do + it { expect( described_class.ok('hello').value ).to eq('hello') } + it { expect( described_class.error('hello').value ).to eq('hello') } + end + + context 'it has status information' do + it { expect( described_class.ok('hello') ).to be_ok } + it { expect( described_class.ok('hello').status ).to eq(:ok) } + + it { expect( described_class.error('hello') ).not_to be_ok } + it { expect( described_class.error('hello').status ).to eq(:error) } + end + + context 'nil is just another value' do + it { expect( described_class.ok(nil) ).to be_ok } + it { expect( described_class.ok(nil).value ).to be_nil } + end +end diff --git a/spec/lib/stif/netex_file_spec.rb b/spec/lib/stif/netex_file_spec.rb new file mode 100644 index 000000000..d84807fe5 --- /dev/null +++ b/spec/lib/stif/netex_file_spec.rb @@ -0,0 +1,27 @@ +require "rails_helper" + +RSpec.describe STIF::NetexFile do + + let( :zip_file ){ fixtures_path 'OFFRE_TRANSDEV_2017030112251.zip' } + + let(:frames) { STIF::NetexFile.new(zip_file).frames } + + it "should return a frame for each sub directory" do + expect(frames.size).to eq(2) + end + + def period(from, to) + Range.new(Date.parse(from), Date.parse(to)) + end + + + context "each frame" do + it "should return the line identifiers defined in frame" do + expect(frames.map(&:line_refs)).to eq([%w{C00109 C00108}]*2) + end + it "should return periods defined in frame calendars" do + expect(frames.map(&:periods)).to eq([[period("2017-04-01", "2017-12-31")], [period("2017-03-01","2017-03-31")]]) + end + end + +end diff --git a/spec/mailers/calendar_mailer_spec.rb b/spec/mailers/calendar_mailer_spec.rb index 49cc3cce8..9a2076f64 100644 --- a/spec/mailers/calendar_mailer_spec.rb +++ b/spec/mailers/calendar_mailer_spec.rb @@ -5,7 +5,7 @@ RSpec.describe CalendarMailer, type: :mailer do shared_examples 'notify all user' do |type| let!(:user) { create(:user) } let(:calendar) { create(:calendar, shared: true) } - let(:email) { CalendarMailer.send(type, calendar, user) } + let(:email) { CalendarMailer.send(type, calendar.id, user.id) } it 'should deliver email to user' do expect(email).to deliver_to user.email diff --git a/spec/models/api/v1/api_key_spec.rb b/spec/models/api/v1/api_key_spec.rb index eb8826c0e..b700429d3 100644 --- a/spec/models/api/v1/api_key_spec.rb +++ b/spec/models/api/v1/api_key_spec.rb @@ -1,13 +1,25 @@ -require 'spec_helper' +require 'rails_helper' -describe Api::V1::ApiKey, :type => :model do - let!(:referential){create(:referential)} - subject { Api::V1::ApiKey.create( :name => "test", :referential => referential)} +RSpec.describe Api::V1::ApiKey, type: :model do + subject { create(:api_key) } - it "test" do - expect(subject).to be_valid - expect(subject.referential).to eq(referential) + it { should validate_presence_of :organisation } + it 'should have a valid factory' do + expect(build(:api_key)).to be_valid + end + + describe '#referential_from_token' do + it 'should return referential' do + referential = Api::V1::ApiKey.referential_from_token(subject.token) + expect(referential).to eq(subject.referential) + end end -end + describe '#organisation_from_token' do + it 'should return organisation' do + organisation = Api::V1::ApiKey.organisation_from_token(subject.token) + expect(organisation).to eq(subject.organisation) + end + end +end diff --git a/spec/models/chouette/footnote_spec.rb b/spec/models/chouette/footnote_spec.rb index 5c09e3931..98d751499 100644 --- a/spec/models/chouette/footnote_spec.rb +++ b/spec/models/chouette/footnote_spec.rb @@ -1,9 +1,22 @@ require 'spec_helper' -describe Chouette::Footnote do - - subject { build(:footnote) } +describe Chouette::Footnote, type: :model do + let(:footnote) { create(:footnote) } it { should validate_presence_of :line } + describe 'checksum' do + it_behaves_like 'checksum support', :footnote + + context '#checksum_attributes' do + it 'should return code and label' do + expected = [footnote.code, footnote.label] + expect(footnote.checksum_attributes).to include(*expected) + end + + it 'should not return other atrributes' do + expect(footnote.checksum_attributes).to_not include(footnote.updated_at) + end + end + end end diff --git a/spec/models/chouette/journey_pattern_spec.rb b/spec/models/chouette/journey_pattern_spec.rb index 6601ed5f4..047022ade 100644 --- a/spec/models/chouette/journey_pattern_spec.rb +++ b/spec/models/chouette/journey_pattern_spec.rb @@ -1,32 +1,35 @@ require 'spec_helper' describe Chouette::JourneyPattern, :type => :model do - - context 'validate minimum stop_points size' do - let(:journey_pattern) { create :journey_pattern } - let(:stop_points) { journey_pattern.stop_points } - - it 'should be valid if it has at least two sp' do - journey_pattern.stop_points.first(stop_points.size - 2).each do |sp| - journey_pattern.stop_points.delete(sp) - end - expect(journey_pattern).to be_valid - end - - it 'should not be valid if it has less then two sp' do - journey_pattern.stop_points.first(stop_points.size - 1).each do |sp| - journey_pattern.stop_points.delete(sp) - end - expect(journey_pattern).to_not be_valid - expect(journey_pattern.errors).to have_key(:stop_points) - end - - it 'should only validate on update' do - jp = build(:journey_pattern_common) - expect(jp).to be_valid - end + describe 'checksum' do + it_behaves_like 'checksum support', :journey_pattern end + # context 'validate minimum stop_points size' do + # let(:journey_pattern) { create :journey_pattern } + # let(:stop_points) { journey_pattern.stop_points } + # + # it 'should be valid if it has at least two sp' do + # journey_pattern.stop_points.first(stop_points.size - 2).each do |sp| + # journey_pattern.stop_points.delete(sp) + # end + # expect(journey_pattern).to be_valid + # end + # + # it 'should not be valid if it has less then two sp' do + # journey_pattern.stop_points.first(stop_points.size - 1).each do |sp| + # journey_pattern.stop_points.delete(sp) + # end + # expect(journey_pattern).to_not be_valid + # expect(journey_pattern.errors).to have_key(:stop_points) + # end + # + # it 'should only validate on update' do + # jp = build(:journey_pattern_common) + # expect(jp).to be_valid + # end + # end + describe "state_update" do def journey_pattern_to_state jp jp.attributes.slice('name', 'published_name', 'registration_number').tap do |item| diff --git a/spec/models/chouette/route/route_base_spec.rb b/spec/models/chouette/route/route_base_spec.rb index 4bf25c2bc..794da4f1b 100644 --- a/spec/models/chouette/route/route_base_spec.rb +++ b/spec/models/chouette/route/route_base_spec.rb @@ -1,6 +1,9 @@ RSpec.describe Chouette::Route, :type => :model do subject { create(:route) } + describe 'checksum' do + it_behaves_like 'checksum support', :route + end describe '#objectid' do subject { super().objectid } @@ -62,8 +65,4 @@ RSpec.describe Chouette::Route, :type => :model do end end end - end - - - diff --git a/spec/models/chouette/routing_constraint_zone_spec.rb b/spec/models/chouette/routing_constraint_zone_spec.rb index 656cb6755..c344642e6 100644 --- a/spec/models/chouette/routing_constraint_zone_spec.rb +++ b/spec/models/chouette/routing_constraint_zone_spec.rb @@ -8,6 +8,10 @@ describe Chouette::RoutingConstraintZone, type: :model do # shoulda matcher to validate length of array ? xit { is_expected.to validate_length_of(:stop_point_ids).is_at_least(2) } + describe 'checksum' do + it_behaves_like 'checksum support', :routing_constraint_zone + end + describe 'validations' do it 'validates the presence of route_id' do expect { @@ -28,8 +32,8 @@ describe Chouette::RoutingConstraintZone, type: :model do }.to raise_error(ActiveRecord::RecordInvalid) end - it 'validates that not all stop points from the route are selected' do - subject.stop_points = subject.route.stop_points + xit 'validates that not all stop points from the route are selected' do + routing_constraint_zone.stop_points = routing_constraint_zone.route.stop_points expect { subject.save! }.to raise_error(ActiveRecord::RecordInvalid) diff --git a/spec/models/chouette/time_table_period_spec.rb b/spec/models/chouette/time_table_period_spec.rb index 07dc602cb..cc1a3ae09 100644 --- a/spec/models/chouette/time_table_period_spec.rb +++ b/spec/models/chouette/time_table_period_spec.rb @@ -4,11 +4,15 @@ describe Chouette::TimeTablePeriod, :type => :model do let!(:time_table) { create(:time_table)} subject { create(:time_table_period ,:time_table => time_table, :period_start => Date.new(2014,6,30), :period_end => Date.new(2014,7,6) ) } - let!(:p2) {create(:time_table_period ,:time_table => time_table, :period_start => Date.new(2014,7,6), :period_end => Date.new(2014,7,14) ) } + let!(:p2) {create(:time_table_period ,:time_table => time_table, :period_start => Date.new(2014,7,6), :period_end => Date.new(2014,7,14) ) } it { is_expected.to validate_presence_of :period_start } it { is_expected.to validate_presence_of :period_end } - + + describe 'checksum' do + it_behaves_like 'checksum support', :time_table_period + end + describe "#overlap" do context "when periods intersect, " do it "should detect period overlap" do diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb index 097eaedf9..761c39e5b 100644 --- a/spec/models/chouette/time_table_spec.rb +++ b/spec/models/chouette/time_table_spec.rb @@ -52,12 +52,19 @@ describe Chouette::TimeTable, :type => :model do expect(subject.int_day_types).to eq int_day_types end - it 'should merge date in_out false' do + it 'should not merge date in_out false' do another_tt.dates.last.in_out = false another_tt.save subject.merge!(another_tt) - expect(subject.dates.map(&:date)).to include(another_tt.dates.last.date) + expect(subject.dates.map(&:date)).not_to include(another_tt.dates.last.date) + end + + it 'should remove all date in_out false' do + subject.dates.create(in_out: false, date: Date.today + 5.day + 1.year) + another_tt.dates.last.in_out = false + subject.merge!(another_tt) + expect(subject.reload.excluded_days.count).to eq(0) end end @@ -833,8 +840,6 @@ end :period_end => Date.new(2013, 05, 30)) expect(time_table.intersects([ Date.new(2013, 05, 27), Date.new(2013, 05, 28)])).to eq([ Date.new(2013, 05, 27), Date.new(2013, 05, 28)]) end - - end describe "#include_day?" do @@ -1038,47 +1043,13 @@ end end end - describe "#effective_days_of_periods" do - before do - subject.periods.clear - subject.periods << Chouette::TimeTablePeriod.new( - :period_start => Date.new(2014, 6, 30), - :period_end => Date.new(2014, 7, 6)) - subject.int_day_types = 4|8|16 - end - it "should return monday to wednesday" do - expect(subject.effective_days_of_periods.size).to eq(3) - expect(subject.effective_days_of_periods[0]).to eq(Date.new(2014, 6, 30)) - expect(subject.effective_days_of_periods[1]).to eq(Date.new(2014, 7, 1)) - expect(subject.effective_days_of_periods[2]).to eq(Date.new(2014, 7, 2)) - end - it "should return thursday" do - expect(subject.effective_days_of_periods(Chouette::TimeTable.valid_days(32)).size).to eq(1) - expect(subject.effective_days_of_periods(Chouette::TimeTable.valid_days(32))[0]).to eq(Date.new(2014, 7, 3)) - end - - end + # it { is_expected.to validate_presence_of :comment } + # it { is_expected.to validate_uniqueness_of :objectid } - describe "#included_days" do - before do - subject.dates.clear - subject.dates << Chouette::TimeTableDate.new( :date => Date.new(2014,7,16), :in_out => true) - subject.dates << Chouette::TimeTableDate.new( :date => Date.new(2014,7,17), :in_out => false) - subject.dates << Chouette::TimeTableDate.new( :date => Date.new(2014,7,18), :in_out => true) - subject.dates << Chouette::TimeTableDate.new( :date => Date.new(2014,7,19), :in_out => false) - subject.dates << Chouette::TimeTableDate.new( :date => Date.new(2014,7,20), :in_out => true) - end - it "should return 3 dates" do - days = subject.included_days - expect(days.size).to eq(3) - expect(days[0]).to eq(Date.new(2014, 7, 16)) - expect(days[1]).to eq(Date.new(2014,7, 18)) - expect(days[2]).to eq(Date.new(2014, 7,20)) - end + describe 'checksum' do + it_behaves_like 'checksum support', :time_table end - - describe "#excluded_days" do before do subject.dates.clear @@ -1124,7 +1095,7 @@ end - describe "#optimize_periods" do + describe "#optimize_overlapping_periods" do before do subject.periods.clear subject.periods << Chouette::TimeTablePeriod.new( @@ -1215,5 +1186,4 @@ end expect(subject.tag_list.size).to eq(2) end end - end diff --git a/spec/models/chouette/vehicle_journey_at_stop_spec.rb b/spec/models/chouette/vehicle_journey_at_stop_spec.rb index d999ed1a8..4f9d12730 100644 --- a/spec/models/chouette/vehicle_journey_at_stop_spec.rb +++ b/spec/models/chouette/vehicle_journey_at_stop_spec.rb @@ -1,6 +1,21 @@ require 'spec_helper' RSpec.describe Chouette::VehicleJourneyAtStop, type: :model do + describe 'checksum' do + let(:at_stop) { build_stubbed(:vehicle_journey_at_stop) } + + it_behaves_like 'checksum support', :vehicle_journey_at_stop + + context '#checksum_attributes' do + it 'should return attributes' do + expected = [at_stop.departure_time.to_s(:time), at_stop.arrival_time.to_s(:time)] + expected << at_stop.departure_day_offset.to_s + expected << at_stop.arrival_day_offset.to_s + expect(at_stop.checksum_attributes).to include(*expected) + end + end + end + describe "#day_offset_outside_range?" do let (:at_stop) { build_stubbed(:vehicle_journey_at_stop) } diff --git a/spec/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator_spec.rb b/spec/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator_spec.rb index c30e0dbd8..d0a15788d 100644 --- a/spec/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator_spec.rb +++ b/spec/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator_spec.rb @@ -13,7 +13,7 @@ describe Chouette::VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator do subject.vehicle_journey_at_stops[1].departure_time end - it "should make instance invalid if departure time exceeds gap" do + it "should make instance invalid if departure time exceeds gap", :skip => "Time gap validation is in pending status" do subject.validate expect( @@ -31,7 +31,7 @@ describe Chouette::VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator do let(:vjas2) { vehicle_journey.vehicle_journey_at_stops[1] } context "when vjas#arrival_time exceeds gap" do - it "should add errors on arrival_time" do + it "should add errors on arrival_time", :skip => "Time gap validation is in pending status" do vjas1.arrival_time = vjas2.arrival_time - 5.hour expect( Chouette::VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator @@ -43,7 +43,7 @@ describe Chouette::VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator do end context "when vjas#departure_time exceeds gap" do - it "should add errors on departure_time" do + it "should add errors on departure_time", :skip => "Time gap validation is in pending status" do vjas1.departure_time = vjas2.departure_time - 5.hour expect( Chouette::VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator @@ -55,7 +55,7 @@ describe Chouette::VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator do end context "when vjas doesn't exceed gap" do - it "should not add errors" do + it "should not add errors", :skip => "Time gap validation is in pending status" do expect( Chouette::VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator .validate_at_stop_times_must_increase(vjas2, vjas1) diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb index 645513735..52f2ab42d 100644 --- a/spec/models/chouette/vehicle_journey_spec.rb +++ b/spec/models/chouette/vehicle_journey_spec.rb @@ -17,8 +17,13 @@ describe Chouette::VehicleJourney, :type => :model do expect(vehicle_journey).to be_valid end + describe 'checksum' do + it_behaves_like 'checksum support', :vehicle_journey + end + describe "vjas_departure_time_must_be_before_next_stop_arrival_time", skip: "Validation currently commented out because it interferes with day offsets" do + let(:vehicle_journey) { create :vehicle_journey } let(:vjas) { vehicle_journey.vehicle_journey_at_stops } @@ -558,18 +563,18 @@ describe Chouette::VehicleJourney, :type => :model do "0"=>{"id" => subject.vehicle_journey_at_stops[0].id ,"arrival_time" => 1.minutes.ago,"departure_time" => 1.minutes.ago}, "1"=>{"id" => subject.vehicle_journey_at_stops[1].id, "arrival_time" => (1.minutes.ago + 4.hour),"departure_time" => (1.minutes.ago + 4.hour)} }}} - it "should return false" do + it "should return false", :skip => "Time gap validation is in pending status" do expect(subject.update_attributes(params)).to be_falsey end - it "should make instance invalid" do + it "should make instance invalid", :skip => "Time gap validation is in pending status" do subject.update_attributes(params) expect(subject).not_to be_valid end - it "should let first vjas without any errors" do + it "should let first vjas without any errors", :skip => "Time gap validation is in pending status" do subject.update_attributes(params) expect(subject.vehicle_journey_at_stops[0].errors).to be_empty end - it "should add an error on second vjas" do + it "should add an error on second vjas", :skip => "Time gap validation is in pending status" do subject.update_attributes(params) expect(subject.vehicle_journey_at_stops[1].errors[:departure_time]).not_to be_blank end diff --git a/spec/models/concerns/error_format_spec.rb b/spec/models/concerns/error_format_spec.rb new file mode 100644 index 000000000..45b4c2f60 --- /dev/null +++ b/spec/models/concerns/error_format_spec.rb @@ -0,0 +1,41 @@ +RSpec.describe ErrorFormat do + + context '#details' do + context 'are empty' do + it 'if no errors are present' do + expect( + described_class.details(build_stubbed(:referential)) + ).to be_empty + end + + it 'if no validation has been carried out' do + invalid = build_stubbed(:referential, name: nil) + expect( described_class.details(invalid) ).to be_empty + end + end + + context 'are not empty' do + it 'if an error is present and validation has been carried out' do + invalid = build_stubbed(:referential, name: nil) + expect( invalid ).not_to be_valid + expect( described_class.details(invalid) ).to eq({ + name: { error: 'doit ĂȘtre rempli(e)', value: nil } + }) + end + + it 'and can even hold many errors' do + create(:referential, name: 'hello') + invalid = build_stubbed( + :referential, + name: 'hello', + slug: 'hello world' + ) + expect( invalid ).not_to be_valid + expect( described_class.details(invalid) ).to eq({ + name: { error: "n'est pas disponible", value: 'hello' }, + slug: { error: "n'est pas valide", value: 'hello world' } + }) + end + end + end +end diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb index a2855d086..941e5b386 100644 --- a/spec/models/import_spec.rb +++ b/spec/models/import_spec.rb @@ -1,10 +1,190 @@ -require 'rails_helper' +RSpec.describe Import, type: :model do -RSpec.describe Import, :type => :model do it { should belong_to(:referential) } it { should belong_to(:workbench) } + it { should belong_to(:parent) } - it { should enumerize(:status).in(:new, :pending, :successful, :failed, :canceled, :running, :aborted ) } + it { should enumerize(:status).in("aborted", "canceled", "failed", "new", "pending", "running", "successful") } it { should validate_presence_of(:file) } + it { should validate_presence_of(:workbench) } + it { should validate_presence_of(:creator) } + + let(:workbench_import) { build_stubbed(:workbench_import) } + let(:workbench_import_with_completed_steps) do + workbench_import = build_stubbed( + :workbench_import, + total_steps: 2, + current_step: 2 + ) + end + + let(:netex_import) do + netex_import = build_stubbed( + :netex_import, + parent: workbench_import + ) + end + + describe "#notify_parent" do + it "must call #child_change on its parent" do + allow(netex_import).to receive(:update) + + expect(workbench_import).to receive(:child_change) + + netex_import.notify_parent + end + + it "must update the :notified_parent_at field of the child import" do + allow(workbench_import).to receive(:child_change) + + Timecop.freeze(DateTime.now) do + expect(netex_import).to receive(:update).with( + notified_parent_at: DateTime.now + ) + + netex_import.notify_parent + end + end + end + + describe "#child_change" do + it "calls #update_status" do + allow(workbench_import).to receive(:update) + + expect(workbench_import).to receive(:update_status) + workbench_import.child_change + end + + it "calls #update_referentials" do + allow(workbench_import).to receive(:update) + + expect(workbench_import).to receive(:update_referentials) + workbench_import.child_change + end + end + + describe "#update_status" do + shared_examples( + "updates :status to failed when >=1 child has failing status" + ) do |failure_status| + it "updates :status to failed when >=1 child has failing status" do + workbench_import = create(:workbench_import) + create( + :netex_import, + parent: workbench_import, + status: failure_status + ) + + workbench_import.update_status + + expect(workbench_import.status).to eq('failed') + end + end + + include_examples( + "updates :status to failed when >=1 child has failing status", + "failed" + ) + include_examples( + "updates :status to failed when >=1 child has failing status", + "aborted" + ) + include_examples( + "updates :status to failed when >=1 child has failing status", + "canceled" + ) + + it "updates :status to successful when all children are successful" do + workbench_import = create(:workbench_import) + create_list( + :netex_import, + 2, + parent: workbench_import, + status: 'successful' + ) + + workbench_import.update_status + + expect(workbench_import.status).to eq('successful') + end + + it "Updates :status to failed when any child has failed" do + workbench_import = create(:workbench_import) + [ + 'failed', + 'successful' + ].each do |status| + create( + :netex_import, + parent: workbench_import, + status: status + ) + end + + workbench_import.update_status + + expect(workbench_import.status).to eq('failed') + end + + it "updates :ended_at to now when status is finished" do + workbench_import = create(:workbench_import) + create( + :netex_import, + parent: workbench_import, + status: 'failed' + ) + + Timecop.freeze(Time.now) do + workbench_import.update_status + + expect(workbench_import.ended_at).to eq(Time.now) + end + end + end + + describe "#update_referentials" do + it "doesn't update referentials if parent status isn't finished" do + workbench_import = create(:workbench_import, status: 'pending') + netex_import = create(:netex_import, parent: workbench_import) + netex_import.referential.update(ready: false) + + workbench_import.update_referentials + netex_import.referential.reload + + expect(netex_import.referential.ready).to be false + end + + shared_examples( + "makes child referentials `ready` when status is finished" + ) do |finished_status| + it "makes child referentials `ready` when status is finished" do + workbench_import = create(:workbench_import, status: finished_status) + netex_import = create(:netex_import, parent: workbench_import) + netex_import.referential.update(ready: false) + + workbench_import.update_referentials + netex_import.referential.reload + + expect(netex_import.referential.ready).to be true + end + end + + include_examples( + "makes child referentials `ready` when status is finished", + "successful" + ) + include_examples( + "makes child referentials `ready` when status is finished", + "failed" + ) + include_examples( + "makes child referentials `ready` when status is finished", + "aborted" + ) + include_examples( + "makes child referentials `ready` when status is finished", + "canceled" + ) + end end diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 527f71015..b16324a56 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -1,5 +1,3 @@ -require 'spec_helper' - describe Organisation, :type => :model do it { should validate_presence_of(:name) } it { should validate_uniqueness_of(:code) } @@ -17,7 +15,7 @@ describe Organisation, :type => :model do let(:conf) { Rails.application.config.stif_portail_api } before :each do stub_request(:get, "#{conf[:url]}/api/v1/organizations"). - with(headers: { 'Authorization' => "Token token=\"#{conf[:key]}\"" }). + with(stub_headers(authorization_token: conf[:key])). to_return(body: File.open(File.join(Rails.root, 'spec', 'fixtures', 'organizations.json')), status: 200) end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 3a9ae37e9..51ccfccd3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -67,7 +67,7 @@ RSpec.describe User, :type => :model do let(:conf) { Rails.application.config.stif_portail_api } before :each do stub_request(:get, "#{conf[:url]}/api/v1/users"). - with(headers: { 'Authorization' => "Token token=\"#{conf[:key]}\"" }). + with(stub_headers(authorization_token: conf[:key])). to_return(body: File.open(File.join(Rails.root, 'spec', 'fixtures', 'users.json')), status: 200) end diff --git a/spec/models/vehicle_journey_import_spec.rb b/spec/models/vehicle_journey_import_spec.rb index e5f4e3b22..7b31dc806 100644 --- a/spec/models/vehicle_journey_import_spec.rb +++ b/spec/models/vehicle_journey_import_spec.rb @@ -86,7 +86,7 @@ describe VehicleJourneyImport, :type => :model do expect(Chouette::VehicleJourneyAtStop.all.size).to eq(17) end - it "should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order" do + it "should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order", :skip => "Time gap validation is in pending status" do expect(VehicleJourneyImport.new(:route => route, :file => invalid_file_on_vjas_object).save).to be_falsey expect(Chouette::VehicleJourney.all.size).to eq(3) expect(Chouette::VehicleJourneyAtStop.all.size).to eq(0) diff --git a/spec/policies/api_key_policy_spec.rb b/spec/policies/api_key_policy_spec.rb new file mode 100644 index 000000000..5b9d59fa3 --- /dev/null +++ b/spec/policies/api_key_policy_spec.rb @@ -0,0 +1,28 @@ +require 'rails_helper' + +RSpec.describe ApiKeyPolicy do + + let(:user) { User.new } + + subject { described_class } + + permissions ".scope" do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :show? do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :create? do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :update? do + pending "add some examples to (or delete) #{__FILE__}" + end + + permissions :destroy? do + pending "add some examples to (or delete) #{__FILE__}" + end +end diff --git a/spec/requests/api/v1/netex_import_spec.rb b/spec/requests/api/v1/netex_import_spec.rb new file mode 100644 index 000000000..06ff76e14 --- /dev/null +++ b/spec/requests/api/v1/netex_import_spec.rb @@ -0,0 +1,117 @@ +RSpec.describe "NetexImport", type: :request do + + describe 'POST netex_imports' do + + let( :referential ){ create :referential } + let( :workbench ){ referential.workbench } + let( :workbench_import ){ create :workbench_import } + + let( :file_path ){ fixtures_path 'single_reference_import.zip' } + let( :file ){ fixture_file_upload( file_path ) } + + let( :post_request ) do + -> (attributes) do + post api_v1_netex_imports_path(format: :json), + attributes, + authorization + end + end + + let( :legal_attributes ) do + { + name: 'offre1', + file: file, + workbench_id: workbench.id, + parent_id: workbench_import.id, + parent_type: workbench_import.class.name + } + end + + + context 'with correct credentials and correct request' do + let( :authorization ){ authorization_token_header( get_api_key.token ) } + + it 'succeeds' do + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + + post_request.(netex_import: legal_attributes) + expect( response ).to be_success + expect( json_response_body ).to eq( + 'id' => NetexImport.last.id, + 'referential_id' => Referential.last.id, + 'workbench_id' => workbench.id + ) + end + + it 'creates a NetexImport object in the DB' do + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + + expect{ post_request.(netex_import: legal_attributes) }.to change{NetexImport.count}.by(1) + end + + it 'creates a correct Referential' do + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108', line_referential: workbench.line_referential) + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109', line_referential: workbench.line_referential) + + legal_attributes # force object creation for correct to change behavior + expect{post_request.(netex_import: legal_attributes)}.to change{Referential.count}.by(1) + Referential.last.tap do | ref | + expect( ref.workbench_id ).to eq(workbench.id) + expect( ref.organisation_id ).to eq(workbench.organisation_id) + end + end + end + + + context 'with incorrect credentials and correct request', pending: "see #4311" do + let( :authorization ){ authorization_token_header( "#{referential.id}-incorrect_token") } + + it 'does not create any DB object and does not succeed' do + legal_attributes # force object creation for correct to change behavior + expect{ post_request.(netex_import: legal_attributes) }.not_to change{Referential.count} + expect( response.status ).to eq(401) + end + + end + + context 'with correct credentials and incorrect request' do + let( :authorization ){ authorization_token_header( get_api_key.token ) } + + shared_examples_for 'illegal attributes' do |bad_attribute, illegal_value=nil| + context "missing #{bad_attribute}" do + let!( :illegal_attributes ){ legal_attributes.merge( bad_attribute => illegal_value ) } + it 'does not succeed' do + # TODO: Handle better when `ReferentialMetadataKludge` is reworked + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00108') + create(:line, objectid: 'STIF:CODIFLIGNE:Line:C00109') + + post_request.(netex_import: illegal_attributes) + expect( response.status ).to eq(406) + expect( json_response_body['errors'][bad_attribute.to_s] ).not_to be_empty + end + + it 'does not create an Import object' do + expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Import.count} + end + + it 'might not create a referential' do + expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Referential.count} + end + end + end + + it_behaves_like 'illegal attributes', :file + it_behaves_like 'illegal attributes', :workbench_id + + # TODO Create a specific test when referential is not created + # context 'name already taken' do + # before do + # create :referential, name: 'already taken' + # end + # it_behaves_like 'illegal attributes', name: 'already taken' + # end + end + end +end diff --git a/spec/routing/api/v1/access_links_routes_spec.rb b/spec/routing/api/v1/access_links_routes_spec.rb new file mode 100644 index 000000000..9164d3f05 --- /dev/null +++ b/spec/routing/api/v1/access_links_routes_spec.rb @@ -0,0 +1,9 @@ +RSpec.describe Api::V1::AccessLinksController, type: :controller do + + it 'routes to index' do + expect( get: '/api/v1/access_links' ).to route_to( + controller: 'api/v1/access_links', + action: 'index' + ) + end +end diff --git a/spec/routing/group_of_lines_spec.rb b/spec/routing/group_of_lines_spec.rb index 2a7262893..01ebeefe4 100644 --- a/spec/routing/group_of_lines_spec.rb +++ b/spec/routing/group_of_lines_spec.rb @@ -1,6 +1,4 @@ -require 'spec_helper' - -describe GroupOfLinesController do +RSpec.describe GroupOfLinesController do describe "routing" do it "not recognize #routes" do expect(get( "/line_referentials/1/group_of_lines/2/routes")).not_to route_to( diff --git a/spec/services/http_service_spec.rb b/spec/services/http_service_spec.rb new file mode 100644 index 000000000..25cc1ee35 --- /dev/null +++ b/spec/services/http_service_spec.rb @@ -0,0 +1,71 @@ +RSpec.describe HTTPService do + + subject{ described_class } + + %i{host params path result}.each do |param| + let(param){ double(param) } + end + let( :token ){ SecureRandom.hex } + + let( :faraday_connection ){ double('faraday_connection') } + let( :headers ){ {} } + + + context 'get_resource' do + let( :params ){ double('params') } + + it 'sets authorization and returns result' do + expect(Faraday).to receive(:new).with(url: host).and_yield(faraday_connection) + expect(faraday_connection).to receive(:adapter).with(Faraday.default_adapter) + expect(faraday_connection).to receive(:headers).and_return headers + expect(faraday_connection).to receive(:get).with(path, params).and_return(result) + + expect(subject.get_resource(host: host, path: path, token: token, params: params)).to eq(result) + expect(headers['Authorization']).to eq( "Token token=#{token.inspect}" ) + end + end + + context 'post_resource' do + %i{as_name mime_type name upload_io value}.each do | param | + let( param ){ double(param) } + end + + let( :upload_list ){ [value, mime_type, as_name] } + + it 'sets authorization and posts data' do + expect(Faraday).to receive(:new).with(url: host).and_yield(faraday_connection) + expect(faraday_connection).to receive(:adapter).with(Faraday.default_adapter) + expect(faraday_connection).to receive(:headers).and_return headers + expect(faraday_connection).to receive(:request).with(:multipart) + expect(faraday_connection).to receive(:request).with(:url_encoded) + + expect(faraday_connection).to receive(:post).with(path, params).and_return(result) + + expect(subject.post_resource( + host: host, + path: path, + token: token, + params: params, + upload: {name => upload_list} )).to eq(result) + expect(headers['Authorization']).to eq( "Token token=#{token.inspect}" ) + end + + end + + context 'get_json_resource' do + + let( :content ){ SecureRandom.hex } + + it 'delegates an parses the response' do + expect_it.to receive(:get_resource) + .with(host: host, path: path, token: token, params: params) + .and_return(double(body: {content: content}.to_json, status: 200)) + + expect( subject.get_json_resource( + host: host, + path: path, + token: token, + params: params) ).to eq('content' => content) + end + end +end diff --git a/spec/services/parent_import_notifier_spec.rb b/spec/services/parent_import_notifier_spec.rb new file mode 100644 index 000000000..3ab505f88 --- /dev/null +++ b/spec/services/parent_import_notifier_spec.rb @@ -0,0 +1,90 @@ +RSpec.describe ParentImportNotifier do + let(:workbench_import) { create(:workbench_import) } + + describe ".notify_when_finished" do + it "calls #notify_parent on finished imports" do + workbench_import = build_stubbed(:workbench_import) + + finished_statuses = [:failed, :successful, :aborted, :canceled] + netex_imports = [] + + finished_statuses.each do |status| + netex_imports << build_stubbed( + :netex_import, + parent: workbench_import, + status: status + ) + end + + netex_imports.each do |netex_import| + expect(netex_import).to receive(:notify_parent) + end + + ParentImportNotifier.notify_when_finished(netex_imports) + end + + it "doesn't call #notify_parent if its `notified_parent_at` is set" do + netex_import = create( + :netex_import, + parent: workbench_import, + status: :failed, + notified_parent_at: DateTime.now + ) + + expect(netex_import).not_to receive(:notify_parent) + + ParentImportNotifier.notify_when_finished + end + end + + describe ".imports_pending_notification" do + it "includes imports with a parent and `notified_parent_at` unset" do + netex_import = create( + :netex_import, + parent: workbench_import, + status: :successful, + notified_parent_at: nil + ) + + expect( + ParentImportNotifier.imports_pending_notification + ).to eq([netex_import]) + end + + it "doesn't include imports without a parent" do + create(:import, parent: nil) + + expect( + ParentImportNotifier.imports_pending_notification + ).to be_empty + end + + it "doesn't include imports that aren't finished" do + [:new, :pending, :running].each do |status| + create( + :netex_import, + parent: workbench_import, + status: status, + notified_parent_at: nil + ) + end + + expect( + ParentImportNotifier.imports_pending_notification + ).to be_empty + end + + it "doesn't include imports that have already notified their parent" do + create( + :netex_import, + parent: workbench_import, + status: :successful, + notified_parent_at: DateTime.now + ) + + expect( + ParentImportNotifier.imports_pending_notification + ).to be_empty + end + end +end diff --git a/spec/services/zip_service/regression_4273_spec.rb b/spec/services/zip_service/regression_4273_spec.rb new file mode 100644 index 000000000..4fe0f6539 --- /dev/null +++ b/spec/services/zip_service/regression_4273_spec.rb @@ -0,0 +1,59 @@ +RSpec.describe ZipService do + describe 'Regression Issue # 4273 https://projects.af83.io/issues/4273' do + let( :zip_service ){ described_class } + let( :unzipper ){ zip_service.new(zip_data) } + let( :zip_data ){ File.read zip_file } + + context 'real test data' do + let( :subdir_names ){ %w<OFFRE_TRANSDEV_20170301122517 OFFRE_TRANSDEV_20170301122519> } + let( :expected_chksums ){ + checksum_trees( subdir_names.map{ |sn| subdir_file(sn, prefix: 'source_') } ) + } + + let( :zip_file ){ fixtures_path 'OFFRE_TRANSDEV_2017030112251.zip' } + # + # Remove potential test artefacts + before do + subdir_names.each do | subdir_name | + File.unlink( subdir_file subdir_name, suffix: '.zip' ) rescue nil + Dir.unlink( subdir_file subdir_name ) rescue nil + end + end + + it "yields the correct content" do + subdir_contents = {} + # Write ZipService Streams to files and inflate them to file system + unzipper.subdirs.each do | subdir | + File.open(subdir_file( subdir.name, suffix: '.zip' ), 'wb'){ |f| f.write subdir.stream.string } + unzip_subdir subdir + end + # Represent the inflated file_system as a checksum tree + actual_checksums = + checksum_trees( subdir_names.map{ |sn| subdir_file(sn, prefix: 'target/') } ) + expect( actual_checksums ).to eq( expected_chksums ) + end + + end + + end + + def checksum_trees *dirs + dirs.flatten.inject({},&method(:checksum_tree)) + end + def checksum_tree repr, dir + Dir.glob("#{dir}/**/*").each do |file| + if !File.directory?(file) + repr.merge!( File.basename(file) => %x{cksum #{file}}.split.first ){ |_, ov, nv| Array(ov) << nv } + end + end + repr + end + + def subdir_file( subdir, prefix: 'target_', suffix: '' ) + fixtures_path("#{prefix}#{subdir}#{suffix}") + end + + def unzip_subdir subdir + %x{unzip -oqq #{subdir_file subdir.name, suffix: '.zip'} -d #{fixture_path}/target} + end +end diff --git a/spec/support/api_key.rb b/spec/support/api_key.rb index 9353fac15..cc08cd7f1 100644 --- a/spec/support/api_key.rb +++ b/spec/support/api_key.rb @@ -1,20 +1,28 @@ module ApiKeyHelper + def authorization_token_header(key) + {'Authorization' => "Token token=#{key}"} + end + def get_api_key - Api::V1::ApiKey.first_or_create( :referential_id => referential.id, :name => "test") + Api::V1::ApiKey.first_or_create(referential: referential, organisation: organisation) end + def config_formatted_request_with_authorization( format) request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials( get_api_key.token) request.accept = format end + def config_formatted_request_with_dummy_authorization( format) request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials( "dummy") request.accept = format end + def config_formatted_request_without_authorization( format) request.env['HTTP_AUTHORIZATION'] = nil request.accept = format end + def json_xml_format? request.accept == "application/json" || request.accept == "application/xml" end diff --git a/spec/support/checksum_support.rb b/spec/support/checksum_support.rb new file mode 100644 index 000000000..14ea3c55e --- /dev/null +++ b/spec/support/checksum_support.rb @@ -0,0 +1,53 @@ +shared_examples 'checksum support' do |factory_name| + let(:instance) { create(factory_name) } + + describe '#current_checksum_source' do + let(:attributes) { ['code_value', 'label_value'] } + let(:seperator) { ChecksumSupport::SEPARATOR } + let(:nil_value) { ChecksumSupport::VALUE_FOR_NIL_ATTRIBUTE } + + before do + allow_any_instance_of(instance.class).to receive(:checksum_attributes).and_return(attributes) + end + + it 'should separate attribute by seperator' do + expect(instance.current_checksum_source).to eq("code_value#{seperator}label_value") + end + + context 'nil value' do + let(:attributes) { ['code_value', nil] } + + it 'should replace nil attributes by default value' do + source = "code_value#{seperator}#{nil_value}" + expect(instance.current_checksum_source).to eq(source) + end + end + + context 'empty array' do + let(:attributes) { ['code_value', []] } + + it 'should convert to nil' do + source = "code_value#{seperator}#{nil_value}" + expect(instance.current_checksum_source).to eq(source) + end + end + end + + it 'should save checksum on create' do + expect(instance.checksum).to_not be_nil + end + + it 'should save checksum_source' do + expect(instance.checksum_source).to_not be_nil + end + + it 'should trigger set_current_checksum_source on save' do + expect(instance).to receive(:set_current_checksum_source) + instance.save + end + + it 'should trigger update_checksum on save' do + expect(instance).to receive(:update_checksum) + instance.save + end +end diff --git a/spec/support/fixtures_helper.rb b/spec/support/fixtures_helper.rb new file mode 100644 index 000000000..20963261b --- /dev/null +++ b/spec/support/fixtures_helper.rb @@ -0,0 +1,18 @@ +module Support + module FixturesHelper + def fixtures_path *segments + Rails.root.join( fixture_path, *segments ) + end + + def open_fixture *segments + File.open(fixtures_path(*segments)) + end + def read_fixture *segments + File.read(fixtures_path(*segments)) + end + end +end + +RSpec.configure do |c| + c.include Support::FixturesHelper +end diff --git a/spec/support/json_helper.rb b/spec/support/json_helper.rb new file mode 100644 index 000000000..a383981a0 --- /dev/null +++ b/spec/support/json_helper.rb @@ -0,0 +1,11 @@ +module Support + module JsonHelper + def json_response_body + JSON.parse(response.body) + end + end +end + +RSpec.configure do | config | + config.include Support::JsonHelper, type: :request +end diff --git a/spec/support/referential.rb b/spec/support/referential.rb index 57b510f69..c431856b8 100644 --- a/spec/support/referential.rb +++ b/spec/support/referential.rb @@ -12,6 +12,7 @@ module ReferentialHelper base.class_eval do extend ClassMethods alias_method :referential, :first_referential + alias_method :organisation, :first_organisation end end diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb new file mode 100644 index 000000000..e9b0025a2 --- /dev/null +++ b/spec/support/shared_context.rb @@ -0,0 +1,15 @@ +shared_context 'iboo authenticated api user' do + let(:api_key) { create(:api_key, organisation: organisation) } + + before do + request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(api_key.organisation.code, api_key.token) + end +end + +shared_context 'iboo wrong authorisation api user' do + let(:api_key) { create(:api_key, organisation: organisation) } + + before do + request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials('fake code', api_key.token) + end +end diff --git a/spec/support/webmock/helpers.rb b/spec/support/webmock/helpers.rb new file mode 100644 index 000000000..fc6c77850 --- /dev/null +++ b/spec/support/webmock/helpers.rb @@ -0,0 +1,18 @@ +module Support + module Webmock + module Helpers + def stub_headers(*args) + {headers: make_headers(*args)} + end + + def make_headers(headers={}, authorization_token:) + headers.merge('Authorization' => "Token token=#{authorization_token.inspect}") + end + end + end +end + +RSpec.configure do | conf | + conf.include Support::Webmock::Helpers, type: :model + conf.include Support::Webmock::Helpers, type: :worker +end diff --git a/spec/tasks/reflex_rake_spec.rb b/spec/tasks/reflex_rake_spec.rb index 04c5886aa..6ece223d2 100644 --- a/spec/tasks/reflex_rake_spec.rb +++ b/spec/tasks/reflex_rake_spec.rb @@ -5,7 +5,7 @@ describe 'reflex:sync' do before(:each) do ['getOP', 'getOR'].each do |method| stub_request(:get, "#{Rails.application.config.reflex_api_url}/?format=xml&idRefa=0&method=#{method}"). - to_return(body: File.open("#{fixture_path}/reflex.zip"), status: 200) + to_return(body: open_fixture('reflex.zip'), status: 200) end stop_area_ref = create(:stop_area_referential, name: 'Reflex') @@ -43,7 +43,7 @@ describe 'reflex:sync' do before(:each) do ['getOP', 'getOR'].each do |method| stub_request(:get, "#{Rails.application.config.reflex_api_url}/?format=xml&idRefa=0&method=#{method}"). - to_return(body: File.open("#{fixture_path}/reflex_updated.zip"), status: 200) + to_return(body: open_fixture('reflex_updated.zip'), status: 200) end Stif::ReflexSynchronization.synchronize end diff --git a/spec/workers/stop_area_referential_sync_worker_spec.rb b/spec/workers/stop_area_referential_sync_worker_spec.rb index 48b64e55e..50c7cf45f 100644 --- a/spec/workers/stop_area_referential_sync_worker_spec.rb +++ b/spec/workers/stop_area_referential_sync_worker_spec.rb @@ -1,4 +1,3 @@ -require 'rails_helper' RSpec.describe StopAreaReferentialSyncWorker, type: :worker do let!(:stop_area_referential_sync) { create :stop_area_referential_sync } diff --git a/spec/workers/workbench_import_worker_spec.rb b/spec/workers/workbench_import_worker_spec.rb new file mode 100644 index 000000000..be07e301a --- /dev/null +++ b/spec/workers/workbench_import_worker_spec.rb @@ -0,0 +1,119 @@ +RSpec.describe WorkbenchImportWorker, + type: [:worker, :request], + skip: "ZipService has been refactored and RetryService was removed. These + tests need to be changed to reflect the new state of the code. Skipping + them because imports need to be ready for QA testing within a day." do + + let( :worker ) { described_class.new } + let( :import ){ build_stubbed :import, token_download: download_token, file: zip_file } + + let( :workbench ){ import.workbench } + let( :referential ){ import.referential } + let( :api_key ){ build_stubbed :api_key, referential: referential, token: "#{referential.id}-#{SecureRandom.hex}" } + let( :params ) do + { netex_import: + { referential_id: referential.id, workbench_id: workbench.id } + } + end + + # http://www.example.com/workbenches/:workbench_id/imports/:id/download + let( :host ){ Rails.configuration.rails_host } + let( :path ){ download_workbench_import_path(workbench, import) } + + let( :downloaded_zip ){ double("downloaded zip") } + let( :download_zip_response ){ OpenStruct.new( body: downloaded_zip ) } + let( :download_token ){ SecureRandom.urlsafe_base64 } + + + let( :upload_path ) { api_v1_netex_imports_path(format: :json) } + + let( :entry_group_streams ) do + entry_count.times.map{ |i| double( "entry group stream #{i}" ) } + end + let( :entry_groups ) do + entry_count.times.map do | i | + {"entry_group_name#{i}" => entry_group_streams[i] } + end + end + + let( :zip_service ){ double("zip service") } + let( :zip_file ){ open_fixture('multiple_references_import.zip') } + + let( :post_response_ok ){ double(status: 201, body: "{}") } + + before do + # Silence Logger + allow_any_instance_of(Logger).to receive(:info) + allow_any_instance_of(Logger).to receive(:warn) + + # That should be `build_stubbed's` job, no? + allow(Import).to receive(:find).with(import.id).and_return(import) + + allow(Api::V1::ApiKey).to receive(:from).and_return(api_key) + allow(ZipService).to receive(:new).with(downloaded_zip).and_return zip_service + expect(zip_service).to receive(:entry_group_streams).and_return(entry_groups) + expect( import ).to receive(:update).with(status: 'running') + end + + + context 'multireferential zipfile, no errors' do + let( :entry_count ){ 2 } + + it 'downloads a zip file, cuts it, and uploads all pieces' do + + expect(HTTPService).to receive(:get_resource) + .with(host: host, path: path, params: {token: download_token}) + .and_return( download_zip_response ) + + entry_groups.each do | entry_group_name, entry_group_stream | + mock_post entry_group_name, entry_group_stream, post_response_ok + end + + expect( import ).to receive(:update).with(total_steps: 2) + expect( import ).to receive(:update).with(current_step: 1) + expect( import ).to receive(:update).with(current_step: 2) + + worker.perform import.id + + end + end + + context 'multireferential zipfile with error' do + let( :entry_count ){ 3 } + let( :post_response_failure ){ double(status: 406, body: {error: 'What was you thinking'}) } + + it 'downloads a zip file, cuts it, and uploads some pieces' do + expect(HTTPService).to receive(:get_resource) + .with(host: host, path: path, params: {token: download_token}) + .and_return( download_zip_response ) + + # First entry_group succeeds + entry_groups[0..0].each do | entry_group_name, entry_group_stream | + mock_post entry_group_name, entry_group_stream, post_response_ok + end + + # Second entry_group fails (M I S E R A B L Y) + entry_groups[1..1].each do | entry_group_name, entry_group_stream | + mock_post entry_group_name, entry_group_stream, post_response_failure + end + + expect( import ).to receive(:update).with(total_steps: 3) + expect( import ).to receive(:update).with(current_step: 1) + expect( import ).to receive(:update).with(current_step: 2) + expect( import ).to receive(:update).with(current_step: 3, status: 'failed') + + worker.perform import.id + + end + end + + def mock_post entry_group_name, entry_group_stream, response + expect( HTTPService ).to receive(:post_resource) + .with(host: host, + path: upload_path, + token: api_key.token, + params: params, + upload: {file: [entry_group_stream, 'application/zip', entry_group_name]}) + .and_return(response) + end +end |
