2 require 'helpers/manifest_examples'
3 require 'helpers/time_block'
8 class BigCollectionsControllerTest < ActionController::TestCase
9 include ManifestExamples
12 Blob.stubs(:sign_locator).returns 'd41d8cd98f00b204e9800998ecf8427e+0'
15 test "combine two big and two small collections" do
16 @controller = ActionsController.new
17 bigmanifest1 = time_block 'build example' do
18 make_manifest(streams: 100,
19 files_per_stream: 100,
23 bigmanifest2 = bigmanifest1.gsub '.txt', '.txt2'
24 smallmanifest1 = ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:small1.txt\n"
25 smallmanifest2 = ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:small2.txt\n"
26 totalsize = bigmanifest1.length + bigmanifest2.length +
27 smallmanifest1.length + smallmanifest2.length
28 parts = time_block "create (total #{totalsize>>20}MiB)" do
31 big1: Collection.create(manifest_text: bigmanifest1),
32 big2: Collection.create(manifest_text: bigmanifest2),
33 small1: Collection.create(manifest_text: smallmanifest1),
34 small2: Collection.create(manifest_text: smallmanifest2),
38 time_block 'combine' do
39 post :combine_selected_files_into_collection, {
40 selection: [parts[:big1].uuid,
42 parts[:small1].uuid + '/small1.txt',
43 parts[:small2].uuid + '/small2.txt',
46 }, session_for(:active)
48 assert_response :redirect
51 [:json, :html].each do |format|
52 test "show collection with big manifest (#{format})" do
53 bigmanifest = time_block 'build example' do
54 make_manifest(streams: 100,
55 files_per_stream: 100,
59 @controller = CollectionsController.new
60 c = time_block "create (manifest size #{bigmanifest.length>>20}MiB)" do
62 Collection.create(manifest_text: bigmanifest)
66 get :show, {id: c.uuid, format: format}, session_for(:active)
68 assert_response :success