2022-08-14 16:44:26 +02:00
|
|
|
|
--liquibase formatted sql
|
|
|
|
|
|
|
|
|
|
-- ============================================================================
|
2022-08-31 14:57:15 +02:00
|
|
|
|
--changeset hs-domain-TEST-DATA-GENERATOR:1 endDelimiter:--//
|
2022-08-14 16:44:26 +02:00
|
|
|
|
-- ----------------------------------------------------------------------------
|
|
|
|
|
/*
|
2022-08-24 17:56:13 +02:00
|
|
|
|
Creates the given count of test unix users for a single package.
|
2022-08-14 16:44:26 +02:00
|
|
|
|
*/
|
2022-08-31 14:57:15 +02:00
|
|
|
|
create or replace procedure createdomainTestData( packageName varchar, domainCount int )
|
2022-08-24 17:56:13 +02:00
|
|
|
|
language plpgsql as $$
|
|
|
|
|
declare
|
|
|
|
|
pac record;
|
|
|
|
|
pacAdmin varchar;
|
|
|
|
|
begin
|
|
|
|
|
select p.uuid, p.name, c.prefix as custPrefix
|
2022-08-31 09:42:40 +02:00
|
|
|
|
from test_package p
|
|
|
|
|
join test_customer c on p.customeruuid = c.uuid
|
2022-08-24 17:56:13 +02:00
|
|
|
|
where p.name = packageName
|
|
|
|
|
into pac;
|
|
|
|
|
|
2022-08-31 14:57:15 +02:00
|
|
|
|
for t in 0..(domainCount-1)
|
2022-08-24 17:56:13 +02:00
|
|
|
|
loop
|
|
|
|
|
pacAdmin = 'pac-admin-' || pac.name || '@' || pac.custPrefix || '.example.com';
|
2024-08-29 16:54:46 +02:00
|
|
|
|
call defineContext('creating RBAC test domain', null, pacAdmin, null);
|
2022-08-24 17:56:13 +02:00
|
|
|
|
|
|
|
|
|
insert
|
2022-08-31 14:57:15 +02:00
|
|
|
|
into test_domain (name, packageUuid)
|
2022-08-24 17:56:13 +02:00
|
|
|
|
values (pac.name || '-' || intToVarChar(t, 4), pac.uuid);
|
|
|
|
|
end loop;
|
|
|
|
|
end; $$;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Creates a range of unix users for mass data generation.
|
|
|
|
|
*/
|
2022-08-31 14:57:15 +02:00
|
|
|
|
create or replace procedure createdomainTestData( domainPerPackage integer )
|
2022-08-14 16:44:26 +02:00
|
|
|
|
language plpgsql as $$
|
|
|
|
|
declare
|
|
|
|
|
pac record;
|
|
|
|
|
pacAdmin varchar;
|
|
|
|
|
currentTask varchar;
|
|
|
|
|
begin
|
|
|
|
|
for pac in
|
|
|
|
|
(select p.uuid, p.name
|
2022-08-31 09:42:40 +02:00
|
|
|
|
from test_package p
|
|
|
|
|
join test_customer c on p.customeruuid = c.uuid
|
2022-08-24 17:56:13 +02:00
|
|
|
|
where c.reference < 90000) -- reserved for functional testing
|
2022-08-14 16:44:26 +02:00
|
|
|
|
loop
|
2022-08-31 14:57:15 +02:00
|
|
|
|
call createdomainTestData(pac.name, 2);
|
2022-08-24 17:56:13 +02:00
|
|
|
|
commit;
|
2022-08-14 16:44:26 +02:00
|
|
|
|
end loop;
|
|
|
|
|
|
2022-08-24 17:56:13 +02:00
|
|
|
|
end; $$;
|
2022-08-14 16:44:26 +02:00
|
|
|
|
--//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ============================================================================
|
2022-08-31 14:57:15 +02:00
|
|
|
|
--changeset hs-domain-TEST-DATA-GENERATION:1 –context=dev,tc endDelimiter:--//
|
2022-08-14 16:44:26 +02:00
|
|
|
|
-- ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
do language plpgsql $$
|
|
|
|
|
begin
|
2022-08-31 14:57:15 +02:00
|
|
|
|
call createdomainTestData('xxx00', 2);
|
|
|
|
|
call createdomainTestData('xxx01', 2);
|
|
|
|
|
call createdomainTestData('xxx02', 2);
|
2022-08-24 17:56:13 +02:00
|
|
|
|
|
2022-08-31 14:57:15 +02:00
|
|
|
|
call createdomainTestData('yyy00', 2);
|
|
|
|
|
call createdomainTestData('yyy01', 2);
|
|
|
|
|
call createdomainTestData('yyy02', 2);
|
2022-08-24 17:56:13 +02:00
|
|
|
|
|
2022-08-31 14:57:15 +02:00
|
|
|
|
call createdomainTestData('zzz00', 2);
|
|
|
|
|
call createdomainTestData('zzz01', 2);
|
|
|
|
|
call createdomainTestData('zzz02', 2);
|
2022-08-14 16:44:26 +02:00
|
|
|
|
end;
|
|
|
|
|
$$;
|
|
|
|
|
--//
|