From cab422572df2a9b60043b00e5edcad34ad1e9ca7 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 11 Nov 2012 10:48:55 -0500 Subject: [PATCH] Concerto test data: realistic call numbers Add a parameter to the populate call number function so that we can define the call number class. As a result, create a new 3-parm version of the function that simply calls the 4-parm version with a NULL value for the 3rd parm. Use some realistic LC and Dewey call numbers for the "concerto" bibs so that we can have more useful tests of the call number browse functionality. Signed-off-by: Dan Scott Signed-off-by: Bill Erickson --- .../tests/datasets/sql/assets_concerto.sql | 108 +++++++++--------- Open-ILS/tests/datasets/sql/assets_fre.sql | 10 +- Open-ILS/tests/datasets/sql/env_create.sql | 13 ++- Open-ILS/tests/datasets/sql/env_destroy.sql | 1 + 4 files changed, 70 insertions(+), 62 deletions(-) diff --git a/Open-ILS/tests/datasets/sql/assets_concerto.sql b/Open-ILS/tests/datasets/sql/assets_concerto.sql index 3c5d01c574..82e050fe03 100644 --- a/Open-ILS/tests/datasets/sql/assets_concerto.sql +++ b/Open-ILS/tests/datasets/sql/assets_concerto.sql @@ -1,57 +1,57 @@ -- Create call numbers -SELECT evergreen.populate_call_number(4, 'CONCERTO ', 'IMPORT CONCERTO'); -- BR1 -SELECT evergreen.populate_call_number(5, 'CONCERTO ', 'IMPORT CONCERTO'); -- BR2 -SELECT evergreen.populate_call_number(6, 'CONCERTO ', 'IMPORT CONCERTO'); -- BR3 -SELECT evergreen.populate_call_number(7, 'CONCERTO ', 'IMPORT CONCERTO'); -- BR4 -SELECT evergreen.populate_call_number(9, 'CONCERTO ', 'IMPORT CONCERTO'); -- BM1 -SELECT evergreen.populate_call_number(4, 'PERFORM ', 'IMPORT CONCERTO'); -- BR1 -SELECT evergreen.populate_call_number(5, 'PERFORM ', 'IMPORT CONCERTO'); -- BR2 -SELECT evergreen.populate_call_number(6, 'PERFORM ', 'IMPORT CONCERTO'); -- BR3 -SELECT evergreen.populate_call_number(7, 'PERFORM ', 'IMPORT CONCERTO'); -- BR4 -SELECT evergreen.populate_call_number(9, 'PERFORM ', 'IMPORT CONCERTO'); -- BM1 +SELECT evergreen.populate_call_number(4, 'ML 2533 B34 C', 'IMPORT CONCERTO', 3); -- BR1 +SELECT evergreen.populate_call_number(5, 'ML1263F', 'IMPORT CONCERTO', 3); -- BR2 +SELECT evergreen.populate_call_number(6, 'MT130M8 G', 'IMPORT CONCERTO', 3); -- BR3 +SELECT evergreen.populate_call_number(7, 'ML 60 R', 'IMPORT CONCERTO', 3); -- BR4 +SELECT evergreen.populate_call_number(9, 'MT 125 .H667 C', 'IMPORT CONCERTO', 3); -- BM1 +SELECT evergreen.populate_call_number(4, '780 B', 'IMPORT CONCERTO', 2); -- BR1 +SELECT evergreen.populate_call_number(5, '780 A', 'IMPORT CONCERTO', 2); -- BR2 +SELECT evergreen.populate_call_number(6, '781 D', 'IMPORT CONCERTO', 2); -- BR3 +SELECT evergreen.populate_call_number(7, '781 G', 'IMPORT CONCERTO', 2); -- BR4 +SELECT evergreen.populate_call_number(9, '780 R', 'IMPORT CONCERTO', 2); -- BM1 -- Create copies -SELECT evergreen.populate_copy(4, 4, 'CONC40000', 'CONCERTO'); -- BR1 -SELECT evergreen.populate_copy(5, 5, 'CONC50000', 'CONCERTO'); -- BR2 -SELECT evergreen.populate_copy(6, 6, 'CONC60000', 'CONCERTO'); -- BR3 -SELECT evergreen.populate_copy(7, 7, 'CONC70000', 'CONCERTO'); -- BR4 -SELECT evergreen.populate_copy(9, 9, 'CONC90000', 'CONCERTO'); -- BM1 - -SELECT evergreen.populate_copy(4, 4, 'CONC41000', 'CONCERTO'); -- BR1 -SELECT evergreen.populate_copy(5, 5, 'CONC51000', 'CONCERTO'); -- BR2 -SELECT evergreen.populate_copy(6, 6, 'CONC61000', 'CONCERTO'); -- BR3 -SELECT evergreen.populate_copy(7, 7, 'CONC71000', 'CONCERTO'); -- BR4 -SELECT evergreen.populate_copy(9, 9, 'CONC91000', 'CONCERTO'); -- BM1 - -SELECT evergreen.populate_copy(4, 4, 'CONC42000', 'CONCERTO'); -- BR1 -SELECT evergreen.populate_copy(5, 5, 'CONC52000', 'CONCERTO'); -- BR2 -SELECT evergreen.populate_copy(6, 6, 'CONC62000', 'CONCERTO'); -- BR3 -SELECT evergreen.populate_copy(7, 7, 'CONC72000', 'CONCERTO'); -- BR4 -SELECT evergreen.populate_copy(9, 9, 'CONC92000', 'CONCERTO'); -- BM1 - -SELECT evergreen.populate_copy(4, 4, 'CONC43000', 'CONCERTO'); -- BR1 -SELECT evergreen.populate_copy(5, 5, 'CONC53000', 'CONCERTO'); -- BR2 -SELECT evergreen.populate_copy(6, 6, 'CONC63000', 'CONCERTO'); -- BR3 -SELECT evergreen.populate_copy(7, 7, 'CONC73000', 'CONCERTO'); -- BR4 -SELECT evergreen.populate_copy(9, 9, 'CONC93000', 'CONCERTO'); -- BM1 - -SELECT evergreen.populate_copy(4, 4, 'CONC44000', 'CONCERTO'); -- BR1 -SELECT evergreen.populate_copy(5, 5, 'CONC54000', 'CONCERTO'); -- BR2 -SELECT evergreen.populate_copy(6, 6, 'CONC64000', 'CONCERTO'); -- BR3 -SELECT evergreen.populate_copy(7, 7, 'CONC74000', 'CONCERTO'); -- BR4 -SELECT evergreen.populate_copy(9, 9, 'CONC94000', 'CONCERTO'); -- BM1 - -SELECT evergreen.populate_copy(4, 4, 'CONC40000', 'PERFORM'); -- BR1 -SELECT evergreen.populate_copy(5, 5, 'CONC50000', 'PERFORM'); -- BR2 -SELECT evergreen.populate_copy(6, 6, 'CONC60000', 'PERFORM'); -- BR3 -SELECT evergreen.populate_copy(7, 7, 'CONC70000', 'PERFORM'); -- BR4 -SELECT evergreen.populate_copy(9, 9, 'CONC90000', 'PERFORM'); -- BM1 - -SELECT evergreen.populate_copy(4, 4, 'CONC41000', 'PERFORM'); -- BR1 -SELECT evergreen.populate_copy(5, 5, 'CONC51000', 'PERFORM'); -- BR2 -SELECT evergreen.populate_copy(6, 6, 'CONC61000', 'PERFORM'); -- BR3 -SELECT evergreen.populate_copy(7, 7, 'CONC71000', 'PERFORM'); -- BR4 -SELECT evergreen.populate_copy(9, 9, 'CONC91000', 'PERFORM'); -- BM1 +SELECT evergreen.populate_copy(4, 4, 'CONC40000', 'M'); -- BR1 +SELECT evergreen.populate_copy(5, 5, 'CONC50000', 'M'); -- BR2 +SELECT evergreen.populate_copy(6, 6, 'CONC60000', 'M'); -- BR3 +SELECT evergreen.populate_copy(7, 7, 'CONC70000', 'M'); -- BR4 +SELECT evergreen.populate_copy(9, 9, 'CONC90000', 'M'); -- BM1 + +SELECT evergreen.populate_copy(4, 4, 'CONC41000', 'M'); -- BR1 +SELECT evergreen.populate_copy(5, 5, 'CONC51000', 'M'); -- BR2 +SELECT evergreen.populate_copy(6, 6, 'CONC61000', 'M'); -- BR3 +SELECT evergreen.populate_copy(7, 7, 'CONC71000', 'M'); -- BR4 +SELECT evergreen.populate_copy(9, 9, 'CONC91000', 'M'); -- BM1 + +SELECT evergreen.populate_copy(4, 4, 'CONC42000', 'M'); -- BR1 +SELECT evergreen.populate_copy(5, 5, 'CONC52000', 'M'); -- BR2 +SELECT evergreen.populate_copy(6, 6, 'CONC62000', 'M'); -- BR3 +SELECT evergreen.populate_copy(7, 7, 'CONC72000', 'M'); -- BR4 +SELECT evergreen.populate_copy(9, 9, 'CONC92000', 'M'); -- BM1 + +SELECT evergreen.populate_copy(4, 4, 'CONC43000', 'M'); -- BR1 +SELECT evergreen.populate_copy(5, 5, 'CONC53000', 'M'); -- BR2 +SELECT evergreen.populate_copy(6, 6, 'CONC63000', 'M'); -- BR3 +SELECT evergreen.populate_copy(7, 7, 'CONC73000', 'M'); -- BR4 +SELECT evergreen.populate_copy(9, 9, 'CONC93000', 'M'); -- BM1 + +SELECT evergreen.populate_copy(4, 4, 'CONC44000', 'M'); -- BR1 +SELECT evergreen.populate_copy(5, 5, 'CONC54000', 'M'); -- BR2 +SELECT evergreen.populate_copy(6, 6, 'CONC64000', 'M'); -- BR3 +SELECT evergreen.populate_copy(7, 7, 'CONC74000', 'M'); -- BR4 +SELECT evergreen.populate_copy(9, 9, 'CONC94000', 'M'); -- BM1 + +SELECT evergreen.populate_copy(4, 4, 'CONC40000', '780'); -- BR1 +SELECT evergreen.populate_copy(5, 5, 'CONC50000', '780'); -- BR2 +SELECT evergreen.populate_copy(6, 6, 'CONC60000', '780'); -- BR3 +SELECT evergreen.populate_copy(7, 7, 'CONC70000', '780'); -- BR4 +SELECT evergreen.populate_copy(9, 9, 'CONC90000', '780'); -- BM1 + +SELECT evergreen.populate_copy(4, 4, 'CONC41000', '780'); -- BR1 +SELECT evergreen.populate_copy(5, 5, 'CONC51000', '780'); -- BR2 +SELECT evergreen.populate_copy(6, 6, 'CONC61000', '780'); -- BR3 +SELECT evergreen.populate_copy(7, 7, 'CONC71000', '780'); -- BR4 +SELECT evergreen.populate_copy(9, 9, 'CONC91000', '780'); -- BM1 -- Delete some copies, call numbers, and bib records DELETE FROM biblio.record_entry @@ -102,12 +102,12 @@ INSERT INTO biblio.monograph_part (record, label) VALUES INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, barcode) SELECT id, owning_lib, 1, 1, 1, 1, 'CONC70001' || id::text FROM asset.call_number - WHERE record IN (53, 84) AND label LIKE 'CONCERTO %' AND owning_lib = 7; + WHERE record IN (53, 84) AND label LIKE 'M%' AND owning_lib = 7; INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, barcode) SELECT id, owning_lib, 1, 1, 1, 1, 'CONC70002' || id::text FROM asset.call_number - WHERE record IN (53, 84) AND label LIKE 'CONCERTO %' AND owning_lib = 7; + WHERE record IN (53, 84) AND label LIKE '78%' AND owning_lib = 7; -- Assign the copies to the parts INSERT INTO asset.copy_part_map (target_copy, part) @@ -128,7 +128,7 @@ INSERT INTO biblio.peer_type (name) INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, barcode) SELECT id, owning_lib, 1, 1, 1, 1, 'PEERBIB' || record::text FROM asset.call_number - WHERE record = 15 AND label LIKE 'CONCERTO %' AND owning_lib = 4; + WHERE record = 15 AND label LIKE 'M%' AND owning_lib = 4; -- Create the peer bib copy map INSERT INTO biblio.peer_bib_copy_map (peer_type, peer_record, target_copy) diff --git a/Open-ILS/tests/datasets/sql/assets_fre.sql b/Open-ILS/tests/datasets/sql/assets_fre.sql index b2cf1b3542..dcf0081a03 100644 --- a/Open-ILS/tests/datasets/sql/assets_fre.sql +++ b/Open-ILS/tests/datasets/sql/assets_fre.sql @@ -1,9 +1,9 @@ -- Create call numbers -SELECT evergreen.populate_call_number(4, 'FRE ', 'IMPORT FRE'); -- BR1 -SELECT evergreen.populate_call_number(5, 'FRE ', 'IMPORT FRE'); -- BR2 -SELECT evergreen.populate_call_number(6, 'FRE ', 'IMPORT FRE'); -- BR3 -SELECT evergreen.populate_call_number(7, 'FRE ', 'IMPORT FRE'); -- BR4 -SELECT evergreen.populate_call_number(9, 'FRE ', 'IMPORT FRE'); -- BM1 +SELECT evergreen.populate_call_number(4, 'FRE ', 'IMPORT FRE', NULL); -- BR1 +SELECT evergreen.populate_call_number(5, 'FRE ', 'IMPORT FRE', NULL); -- BR2 +SELECT evergreen.populate_call_number(6, 'FRE ', 'IMPORT FRE', NULL); -- BR3 +SELECT evergreen.populate_call_number(7, 'FRE ', 'IMPORT FRE', NULL); -- BR4 +SELECT evergreen.populate_call_number(9, 'FRE ', 'IMPORT FRE', NULL); -- BM1 -- Create copies SELECT evergreen.populate_copy(4, 4, 'FRE40000', 'FRE'); -- BR1 diff --git a/Open-ILS/tests/datasets/sql/env_create.sql b/Open-ILS/tests/datasets/sql/env_create.sql index d27d69857e..e38e709e5a 100644 --- a/Open-ILS/tests/datasets/sql/env_create.sql +++ b/Open-ILS/tests/datasets/sql/env_create.sql @@ -11,18 +11,25 @@ CREATE TABLE marcxml_import (id SERIAL PRIMARY KEY, marc TEXT, tag TEXT); * whose last_xact_id matches bib_tag */ CREATE FUNCTION evergreen.populate_call_number - (ownlib INTEGER, label TEXT, bib_tag TEXT) + (ownlib INTEGER, label TEXT, bib_tag TEXT, class INTEGER DEFAULT 1) RETURNS void AS $$ INSERT INTO asset.call_number (record, creator, editor, owning_lib, label, label_class) - SELECT id, 1, 1, $1, $2 || id::text, 1 + SELECT id, 1, 1, $1, $2 || id::text, $4 FROM biblio.record_entry WHERE id > 0 AND CASE WHEN $3 IS NULL THEN TRUE ELSE last_xact_id = $3 END; $$ LANGUAGE SQL; +CREATE FUNCTION evergreen.populate_call_number + (ownlib INTEGER, label TEXT, bib_tag TEXT) +RETURNS void AS $$ + SELECT evergreen.populate_call_number($1, $2, $3, NULL); +$$ LANGUAGE SQL; + + /* - * create a copy for every callnumber in the database whose label and owninb_lib + * create a copy for every callnumber in the database whose label and owning_lib * matches, appending the callnumber ID to the copy barcode to differentate. */ CREATE FUNCTION evergreen.populate_copy diff --git a/Open-ILS/tests/datasets/sql/env_destroy.sql b/Open-ILS/tests/datasets/sql/env_destroy.sql index bb8fc9df7d..7c50514f6a 100644 --- a/Open-ILS/tests/datasets/sql/env_destroy.sql +++ b/Open-ILS/tests/datasets/sql/env_destroy.sql @@ -2,6 +2,7 @@ -- clean up our temp tables / functions DROP TABLE marcxml_import; DROP FUNCTION evergreen.populate_call_number(INTEGER, TEXT, TEXT); +DROP FUNCTION evergreen.populate_call_number(INTEGER, TEXT, TEXT, INTEGER); DROP FUNCTION evergreen.populate_copy(INTEGER, INTEGER, TEXT, TEXT); DROP FUNCTION evergreen.next_copy (BIGINT); DROP FUNCTION evergreen.next_bib (BIGINT); -- 2.43.2