#!/usr/bin/env python import ddm c = ddm.connect("localhost:8282", proto="http") #id = "InCSE1/10028/20020/30019" #x=c.retrieve(id) #x=c.update(id, {"contents": "bozo"}) ae = ddm.id(c.create("InCSE1", "AE")) co = ddm.id(c.create(ae, "container")) ci = ddm.id(c.create(co, "contentInstance", {"content": "102"})) print "ae", ae print "co", co print "ci", ci def huh(x): if x == None: print "c.error", c.error else: print "x", x x = c.update(ae, {"labels":"100"}) huh(x) x = c.update(co, {"labels":"101"}) huh(x) x = c.retrieve(ci) huh(x)
#!/usr/bin/env python import ddm c = ddm.connect("127.0.0.1:8080") # make an AE for our test q = c.create("InCSE1", "AE") if q == None: print "AE create failed" exit() print q ae = ddm.id(q) print "AE resource ID is %s" % (ae) # make a container under our AE for the test q = c.create(ae, "container") if q == None: print "container create failed" exit() co = ddm.id(q) print "container resource ID is %s" % (co) # n is the number of times we go through the CRUD sequence n = 100 for i in range(0, n): # create a contentInstance under our container with content set to 10 q = c.create(co, "contentInstance", {"content":"10"}) if q == None: print "error during create"
#!/usr/bin/env python import ddm c = ddm.connect("localhost:8282", "admin", "admin", protocol="http") ae = ddm.id(c.create("InCSE1", "AE")) if ae == None: print "!ae", c.error cr = ddm.id(c.create(ae, "container")) if cr == None: print "!cr", c.error x = c.create(cr, "subscription", {"notificationURI":"http://localhost:20000", "notificationContentType":"wholeResource"}) if x == None: print "!su", c.error su = ddm.id(x) ci = ddm.id(c.create(cr, "contentInstance", {"content": "102"})) if ci == None: print "!ci", c.error print ddm.AE, ae print ddm.CR, cr print ddm.CI, ci print "su", ci exit() def huh(x): if x == None: print "c.error", c.error else: print "x", x
def connect_to_ddm(host, user, pw, p): return ddm.connect(host, user, pw, proto=p)