From b7c0b9ed7f9eb53c1e48c77fb6632da7189e13ec Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 21 Aug 2004 09:45:14 +0000 Subject: [PATCH] further improve tests; line-up with code --- .../rdbms_depend/mysql/testdb_metadata.sql | 17 +- .../rdbms_depend/pgsql/testdb_metadata.sql | 70 ++++++- tests/data/slapd-sql.conf | 2 +- tests/data/sqlmaster.out | 194 +++++++++++------- tests/data/sqlmods.out | 61 +++--- tests/scripts/test031-sql | 62 +++++- 6 files changed, 289 insertions(+), 117 deletions(-) diff --git a/servers/slapd/back-sql/rdbms_depend/mysql/testdb_metadata.sql b/servers/slapd/back-sql/rdbms_depend/mysql/testdb_metadata.sql index b43a574b93..4958b1fc16 100644 --- a/servers/slapd/back-sql/rdbms_depend/mysql/testdb_metadata.sql +++ b/servers/slapd/back-sql/rdbms_depend/mysql/testdb_metadata.sql @@ -45,23 +45,26 @@ insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where, values (5,1,'userPassword','persons.password','persons','persons.password IS NOT NULL',NULL,NULL,3,0); insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) -values (6,2,'description','documents.abstract','documents',NULL,NULL,NULL,3,0); +values (6,1,'seeAlso','seeAlso.dn','ldap_entries AS seeAlso,documents,authors_docs,persons', + 'seeAlso.keyval=documents.id AND seeAlso.oc_map_id=2 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id', + NULL,NULL,3,0); + +insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) +values (7,2,'description','documents.abstract','documents',NULL,NULL,NULL,3,0); insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) -values (7,2,'documentTitle','documents.title','documents',NULL,NULL,NULL,3,0); +values (8,2,'documentTitle','documents.title','documents',NULL,NULL,NULL,3,0); insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) -values (8,2,'documentAuthor','documentAuthor.dn','ldap_entries AS documentAuthor,documents,authors_docs,persons', +values (9,2,'documentAuthor','documentAuthor.dn','ldap_entries AS documentAuthor,documents,authors_docs,persons', 'documentAuthor.keyval=persons.id AND documentAuthor.oc_map_id=1 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id', NULL,NULL,3,0); insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) -values (9,3,'o','institutes.name','institutes',NULL,NULL,NULL,3,0); +values (10,2,'documentIdentifier','concat(''document '',documents.id)','documents',NULL,NULL,NULL,3,0); insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) -values (10,1,'documentIdentifier','documentIdentifier.dn','ldap_entries AS documentIdentifier,documents,authors_docs,persons', - 'documentIdentifier.keyval=documents.id AND documentIdentifier.oc_map_id=2 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id', - NULL,NULL,3,0); +values (11,3,'o','institutes.name','institutes',NULL,NULL,NULL,3,0); -- entries mapping: each entry must appear in this table, with a unique DN rooted at the database naming context -- id a unique number > 0 identifying the entry diff --git a/servers/slapd/back-sql/rdbms_depend/pgsql/testdb_metadata.sql b/servers/slapd/back-sql/rdbms_depend/pgsql/testdb_metadata.sql index 3b9943bc1b..d42103370a 100644 --- a/servers/slapd/back-sql/rdbms_depend/pgsql/testdb_metadata.sql +++ b/servers/slapd/back-sql/rdbms_depend/pgsql/testdb_metadata.sql @@ -10,9 +10,9 @@ -- expect_return a bitmap that marks whether create_proc (1) and delete_proc (2) return a value or not insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return) values (1,'inetOrgPerson','persons','id','select create_person()','select delete_person(?)',0); -insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return) values (2,'document','documents','id',NULL,NULL,0); +insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return) values (2,'document','documents','id','select create_doc()','select delete_doc(?)',0); -insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return) values (3,'organization','institutes','id',NULL,NULL,0); +insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return) values (3,'organization','institutes','id','select create_o()','select delete_o(?)',0); -- attributeType mappings: describe how an attributeType for a certain objectClass maps to the SQL data. -- id a unique number identifying the attribute @@ -35,15 +35,17 @@ insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where, insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (5,1,'userPassword','persons.password','persons','persons.password IS NOT NULL','update persons set password=? where id=?',NULL,3,0); -insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (6,2,'description','documents.abstract','documents',NULL,NULL,NULL,3,0); +insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (6,1,'seeAlso','seeAlso.dn','ldap_entries AS seeAlso,documents,authors_docs,persons','seeAlso.keyval=documents.id AND seeAlso.oc_map_id=2 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id',NULL,NULL,3,0); -insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (7,2,'documentTitle','documents.title','documents',NULL,NULL,NULL,3,0); +insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (7,2,'description','documents.abstract','documents',NULL,'update documents set abstract=? where id=?',NULL,3,0); -insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (8,2,'documentAuthor','documentAuthor.dn','ldap_entries AS documentAuthor,documents,authors_docs,persons','documentAuthor.keyval=persons.id AND documentAuthor.oc_map_id=1 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id',NULL,NULL,3,0); - -insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (9,3,'o','institutes.name','institutes',NULL,NULL,NULL,3,0); +insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (8,2,'documentTitle','documents.title','documents',NULL,'update documents set title=? where id=?',NULL,3,0); + +insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (9,2,'documentAuthor','documentAuthor.dn','ldap_entries AS documentAuthor,documents,authors_docs,persons','documentAuthor.keyval=persons.id AND documentAuthor.oc_map_id=1 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id','select add_doc_author(?,?)','select delete_doc_author(?,?)',3,0); -insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (10,1,'documentIdentifier','documentIdentifier.dn','ldap_entries AS documentIdentifier,documents,authors_docs,persons','documentIdentifier.keyval=documents.id AND documentIdentifier.oc_map_id=2 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id',NULL,NULL,3,0); +insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (10,2,'documentIdentifier','''document ''||text(documents.id)','documents',NULL,NULL,NULL,3,0); + +insert into ldap_attr_mappings (id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return) values (11,3,'o','institutes.name','institutes',NULL,'update institutes set name=? where id=?',NULL,3,0); -- entries mapping: each entry must appear in this table, with a unique DN rooted at the database naming context @@ -81,7 +83,7 @@ insert into ldap_referrals (entry_id,url) values (4,'ldap://localhost/'); -- these procedures are specific for this RDBMS and are used in mapping objectClass and attributeType creation/modify/deletion create function create_person () returns int as ' - select setval (''persons_id_seq'', (select max(id) from persons)); + select setval (''persons_id_seq'', (select case when max(id) is null then 1 else max(id) end from persons)); insert into persons (id,name,surname) values (nextval(''persons_id_seq''),'''',''''); select max(id) from persons @@ -113,7 +115,7 @@ as ' create function add_phone (varchar, int) returns int as ' - select setval (''phones_id_seq'', (select max(id) from phones)); + select setval (''phones_id_seq'', (select case when max(id) is null then 1 else max(id) end from phones)); insert into phones (id,phone,pers_id) values (nextval(''phones_id_seq''),$1,$2); select max(id) from phones @@ -125,3 +127,51 @@ as ' select $2 as result ' language 'sql'; +create function create_doc () returns int +as ' + select setval (''documents_id_seq'', (select case when max(id) is null then 1 else max(id) end from documents)); + insert into documents (id,title,abstract) + values (nextval(''documents_id_seq''),'''',''''); + select max(id) from documents +' language 'sql'; + +create function delete_doc (int) returns int +as ' + delete from documents where id = $1; + select $1 as return +' language 'sql'; + +create function create_o () returns int +as ' + select setval (''institutes_id_seq'', (select case when max(id) is null then 1 else max(id) end from institutes)); + insert into institutes (id,name) + values (nextval(''institutes_id_seq''),''''); + select max(id) from institutes +' language 'sql'; + +create function delete_o (int) returns int +as ' + delete from institutes where id = $1; + select $1 as return +' language 'sql'; + +create function add_doc_author (varchar, int) returns int +as ' + insert into authors_docs (pers_id,doc_id) values (( + select ldap_entries.keyval + from ldap_entries + where upper($1) = upper(ldap_entries.dn) + ),$2); + select $2 as return +' language 'sql'; + +create function delete_doc_author (varchar, int) returns int +as ' + delete from authors_docs where authors_docs.pers_id = ( + select ldap_entries.keyval + from ldap_entries + where upper($1) = upper(ldap_entries.dn) + ) and authors_docs.doc_id = $2; + select $2 as return +' language 'sql'; + diff --git a/tests/data/slapd-sql.conf b/tests/data/slapd-sql.conf index 86da386d46..13356523fe 100644 --- a/tests/data/slapd-sql.conf +++ b/tests/data/slapd-sql.conf @@ -55,7 +55,7 @@ dbpasswd secret # rdbms specific directives # # PostgreSQL -#postgres#insentry_query "insert into ldap_entries (id,dn,oc_map_id,parent,keyval) values ((select max(id)+1 from ldap_entries),?,?,?,?)" +#postgres#insentry_query "insert into ldap_entries (id,dn,oc_map_id,parent,keyval) values ((select case when max(id) is null then 1 else max(id) + 1 end from ldap_entries),?,?,?,?)" #postgres#upper_func "upper" #postgres#strcast_func "text" #postgres#concat_pattern "?||?" diff --git a/tests/data/sqlmaster.out b/tests/data/sqlmaster.out index bc118b2ff7..578b310bc1 100644 --- a/tests/data/sqlmaster.out +++ b/tests/data/sqlmaster.out @@ -1,101 +1,115 @@ # Testing search... -# refldap://localhost/o=Example,c=RU??sub - -dn: cn=Torvlobnor Puzdoy,o=Example,c=RU -objectClass: inetOrgPerson -cn: Torvlobnor Puzdoy -telephoneNumber: 545-4563 -givenName: Torvlobnor -sn: Puzdoy -documentIdentifier: documentTitle=book1,o=Example,c=RU - -dn: cn=Mitya Kovalev,o=Example,c=RU -objectClass: inetOrgPerson -objectClass: posixAccount -cn: Mitya Kovalev -telephoneNumber: 332-2334 -telephoneNumber: 222-3234 -givenName: Mitya -sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU - -dn: documentTitle=book2,o=Example,c=RU -objectClass: document -description: abstract2 -documentTitle: book2 -documentAuthor: cn=Mitya Kovalev,o=Example,c=RU - dn: documentTitle=book1,o=Example,c=RU objectClass: document description: abstract1 documentTitle: book1 documentAuthor: cn=Mitya Kovalev,o=Example,c=RU documentAuthor: cn=Torvlobnor Puzdoy,o=Example,c=RU +documentIdentifier: document 1 + +dn: documentTitle=book2,o=Example,c=RU +objectClass: document +description: abstract2 +documentTitle: book2 +documentAuthor: cn=Mitya Kovalev,o=Example,c=RU +documentIdentifier: document 2 dn: o=Example,c=RU objectClass: organization o: Example -# Testing exact search... dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 -givenName: Mitya + +dn: cn=Torvlobnor Puzdoy,o=Example,c=RU +objectClass: inetOrgPerson +cn: Torvlobnor Puzdoy +sn: Puzdoy +seeAlso: documentTitle=book1,o=Example,c=RU +givenName: Torvlobnor +telephoneNumber: 545-4563 + +# refldap://localhost/o=Example,c=RU??sub + +# Testing exact search... +dn: cn=Mitya Kovalev,o=Example,c=RU +objectClass: inetOrgPerson +objectClass: posixAccount +cn: Mitya Kovalev sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya +telephoneNumber: 332-2334 +telephoneNumber: 222-3234 # Testing substrings initial search... dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 -givenName: Mitya -sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU # Testing substrings any search... dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 -givenName: Mitya -sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU # Testing substrings final search... dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 -givenName: Mitya -sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU # Testing approx search... dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 -givenName: Mitya + +# Testing extensible filter search... +dn: cn=Mitya Kovalev,o=Example,c=RU +objectClass: inetOrgPerson +objectClass: posixAccount +cn: Mitya Kovalev sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya +telephoneNumber: 332-2334 +telephoneNumber: 222-3234 # Testing attribute inheritance in filter... dn: o=Example,c=RU @@ -103,60 +117,96 @@ objectClass: organization o: Example # Testing objectClass inheritance in filter... -# refldap://localhost/o=Example,c=RU??sub - -dn: cn=Torvlobnor Puzdoy,o=Example,c=RU -objectClass: inetOrgPerson -cn: Torvlobnor Puzdoy -telephoneNumber: 545-4563 -givenName: Torvlobnor -sn: Puzdoy -documentIdentifier: documentTitle=book1,o=Example,c=RU - dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 -givenName: Mitya -sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU + +dn: cn=Torvlobnor Puzdoy,o=Example,c=RU +objectClass: inetOrgPerson +cn: Torvlobnor Puzdoy +sn: Puzdoy +seeAlso: documentTitle=book1,o=Example,c=RU +givenName: Torvlobnor +telephoneNumber: 545-4563 + +# refldap://localhost/o=Example,c=RU??sub # Testing "auxiliary" objectClass in filter... dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 -givenName: Mitya -sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU + +# Testing hasSubordinates in filter... +dn: o=Example,c=RU +objectClass: organization +o: Example + +# refldap://localhost/o=Example,c=RU??sub # Testing attribute inheritance in requested attributes... dn: cn=Mitya Kovalev,o=Example,c=RU cn: Mitya Kovalev -givenName: Mitya sn: Kovalev +givenName: Mitya # Testing objectClass in requested attributes... -Additional information: bad_referral object -dn: cn=Torvlobnor Puzdoy,o=Example,c=RU -objectClass: inetOrgPerson +dn: documentTitle=book1,o=Example,c=RU +objectClass: document + +dn: documentTitle=book2,o=Example,c=RU +objectClass: document + +dn: o=Example,c=RU +objectClass: organization dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount -dn: documentTitle=book2,o=Example,c=RU -objectClass: document +dn: cn=Torvlobnor Puzdoy,o=Example,c=RU +objectClass: inetOrgPerson +# refldap://localhost/o=Example,c=RU??sub + +# Testing operational attributes in request... dn: documentTitle=book1,o=Example,c=RU -objectClass: document +structuralObjectClass: document +subschemaSubentry: cn=Subschema +hasSubordinates: FALSE + +dn: documentTitle=book2,o=Example,c=RU +structuralObjectClass: document +subschemaSubentry: cn=Subschema +hasSubordinates: FALSE dn: o=Example,c=RU -objectClass: organization +structuralObjectClass: organization +subschemaSubentry: cn=Subschema +hasSubordinates: TRUE + +dn: cn=Mitya Kovalev,o=Example,c=RU +structuralObjectClass: inetOrgPerson +subschemaSubentry: cn=Subschema +hasSubordinates: FALSE + +dn: cn=Torvlobnor Puzdoy,o=Example,c=RU +structuralObjectClass: inetOrgPerson +subschemaSubentry: cn=Subschema +hasSubordinates: FALSE + +# refldap://localhost/o=Example,c=RU??sub diff --git a/tests/data/sqlmods.out b/tests/data/sqlmods.out index 54d5ef33db..e4a7cdf4eb 100644 --- a/tests/data/sqlmods.out +++ b/tests/data/sqlmods.out @@ -1,37 +1,48 @@ -dn: cn=Pierangelo Masarati,o=Example,c=RU -objectClass: inetOrgPerson -cn: Pierangelo Masarati -telephoneNumber: +39 333 ZZZ 1234 -givenName: Pierangelo -sn: Masarati +dn: documentTitle=book1,o=Example,c=RU +objectClass: document +description: abstract1 +documentTitle: book1 +documentAuthor: cn=Mitya Kovalev,o=Example,c=RU +documentAuthor: cn=Pierangelo Masarati,o=Example,c=RU +documentIdentifier: document 1 -# refldap://localhost/o=Example,c=RU??sub +dn: documentTitle=book2,o=Example,c=RU +objectClass: document +description: abstract2 +documentTitle: book2 +documentAuthor: cn=Mitya Kovalev,o=Example,c=RU +documentAuthor: cn=Pierangelo Masarati,o=Example,c=RU +documentIdentifier: document 2 + +dn: o=Example,c=RU +objectClass: organization +o: Example + +dn: o=Another Org,o=Example,c=RU +objectClass: organization +o: Another Org dn: cn=Mitya Kovalev,o=Example,c=RU objectClass: inetOrgPerson objectClass: posixAccount cn: Mitya Kovalev +sn: Kovalev +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Mitya telephoneNumber: 332-2334 telephoneNumber: 222-3234 telephoneNumber: +1 800 123 4567 -givenName: Mitya -sn: Kovalev -documentIdentifier: documentTitle=book1,o=Example,c=RU -documentIdentifier: documentTitle=book2,o=Example,c=RU - -dn: documentTitle=book2,o=Example,c=RU -objectClass: document -description: abstract2 -documentTitle: book2 -documentAuthor: cn=Mitya Kovalev,o=Example,c=RU -dn: documentTitle=book1,o=Example,c=RU -objectClass: document -description: abstract1 -documentTitle: book1 -documentAuthor: cn=Mitya Kovalev,o=Example,c=RU +# refldap://localhost/o=Example,c=RU??sub -dn: o=Example,c=RU -objectClass: organization -o: Example +dn: cn=Pierangelo Masarati,o=Example,c=RU +objectClass: inetOrgPerson +cn: Pierangelo Masarati +sn: Masarati +seeAlso: documentTitle=book1,o=Example,c=RU +seeAlso: documentTitle=book2,o=Example,c=RU +givenName: Pierangelo +telephoneNumber: +39 02 XXXX ZZZZ +telephoneNumber: +39 333 ZZZ 1234 diff --git a/tests/scripts/test031-sql b/tests/scripts/test031-sql index 607529f318..a7bc677918 100755 --- a/tests/scripts/test031-sql +++ b/tests/scripts/test031-sql @@ -148,6 +148,18 @@ if test $RC != 0 ; then exit $RC fi +echo "Testing extensible filter search..." +echo "# Testing extensible filter search..." >> $SEARCHOUT +$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + "(sn:caseExactMatch:=Kovalev)" >> $SEARCHOUT 2>&1 + +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + echo "Testing attribute inheritance in filter..." echo "# Testing attribute inheritance in filter..." >> $SEARCHOUT $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ @@ -184,6 +196,18 @@ if test $RC != 0 ; then exit $RC fi +echo "Testing hasSubordinates in filter..." +echo "# Testing hasSubordinates in filter..." >> $SEARCHOUT +$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + "(hasSubordinates=TRUE)" >> $SEARCHOUT 2>&1 + +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + echo "Testing attribute inheritance in requested attributes..." echo "# Testing attribute inheritance in requested attributes..." >> $SEARCHOUT $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ @@ -208,9 +232,21 @@ if test $RC != 0 ; then exit $RC fi +echo "Testing operational attributes in request..." +echo "# Testing operational attributes in request..." >> $SEARCHOUT +$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ + '+' >> $SEARCHOUT 2>&1 + +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + echo "Filtering ldapsearch results..." . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT -echo "Filtering original ldif used to create database..." +echo "Filtering original ldif..." . $LDIFFILTER < $SQLMASTER > $LDIFFLT echo "Comparing filter output..." $CMP $SEARCHFLT $LDIFFLT > $CMPOUT @@ -261,6 +297,28 @@ telephoneNumber: +39 333 ZZZ 1234 dn: cn=Torvlobnor Puzdoy,${BASEDN} changetype: delete +dn: o=An Org,${BASEDN} +changetype: add +objectClass: organization +o: An Org + +dn: o=An Org,${BASEDN} +changetype: modrdn +newrdn: o=Another Org +deleteoldrdn: 1 + +dn: documentTitle=book1,${BASEDN} +changetype: modify +add: documentAuthor +documentAuthor: cn=Pierangelo Masarati,${BASEDN} +- + +dn: documentTitle=book2,${BASEDN} +changetype: modify +add: documentAuthor +documentAuthor: cn=Pierangelo Masarati,${BASEDN} +- + EOMODS RC=$? @@ -283,7 +341,7 @@ EOMODS echo "Filtering ldapsearch results..." . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT - echo "Filtering original ldif used to create database..." + echo "Filtering modified ldif..." . $LDIFFILTER < $SQLMODS > $LDIFFLT echo "Comparing filter output..." $CMP $SEARCHFLT $LDIFFLT > $CMPOUT -- 2.39.5