factor/unmaintained/ldap/ldap-tests.factor

59 lines
1.4 KiB
Factor
Raw Normal View History

2008-03-08 05:27:19 -05:00
USING: alien alien.c-types io kernel ldap ldap.libldap
namespaces prettyprint tools.test ;
IN: ldap.tests
2007-09-20 18:09:08 -04:00
"void*" <c-object> "ldap://localhost:389" initialize
get-ldp LDAP_OPT_PROTOCOL_VERSION LDAP_VERSION3 <int> set-option
2008-03-08 05:27:19 -05:00
[ 3 ] [
2007-09-20 18:09:08 -04:00
get-ldp LDAP_OPT_PROTOCOL_VERSION "int*" <c-object> [ get-option ] keep
2008-03-06 14:46:15 -05:00
*int
2007-09-20 18:09:08 -04:00
] unit-test
2008-03-06 14:46:15 -05:00
[
2008-03-08 05:27:19 -05:00
get-ldp "cn=jimbob,dc=example,dc=com" "secret" [
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
! get-ldp "dc=example,dc=com" LDAP_SCOPE_ONELEVEL "(objectclass=*)" f 0
! "void*" <c-object> [ search-s ] keep *int .
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
[ 2 ] [
get-ldp "dc=example,dc=com" LDAP_SCOPE_SUBTREE "(objectclass=*)" f 0
search
] unit-test
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
! get-ldp LDAP_RES_ANY 0 f "void*" <c-object> result .
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-ldp LDAP_RES_ANY LDAP_MSG_ALL f "void*" <c-object> result
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
! get-message *int .
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
"Message ID: " write
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-message msgid .
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-ldp get-message get-dn .
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
"Entries count: " write
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-ldp get-message count-entries .
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
SYMBOL: entry
SYMBOL: attr
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
"Attribute: " write
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-ldp get-message first-entry entry set get-ldp entry get
"void*" <c-object> first-attribute dup . attr set
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
"Value: " write
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-ldp entry get attr get get-values *char* .
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-ldp get-message first-message msgtype result-type
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
get-ldp get-message next-message msgtype result-type
2007-09-20 18:09:08 -04:00
2008-03-08 05:27:19 -05:00
] with-bind
2008-03-06 14:46:15 -05:00
] drop