You are viewing a plain text version of this content. The canonical link for it is here.
Posted to triplesoup-commits@incubator.apache.org by le...@apache.org on 2007/02/19 13:01:12 UTC

svn commit: r509187 - in /incubator/triplesoup/code/trunk: modules/ modules/pysoup/ modules/pysoup/pysoup/ modules/pysoup/scripts/ tests/ tests/01-basic-self-test/

Author: leosimons
Date: Mon Feb 19 05:01:11 2007
New Revision: 509187

URL: http://svn.apache.org/viewvc?view=rev&rev=509187
Log:
Start on some tooling to allow setting up basic triplesoup tests.

 * modules/pysoup/: simple python scripts to allow basic remote RDF database
   management over HTTP and a SQL-like language.

 * tests/: simple bash-based integration testing framework. See README.txt.
 
 * test/s01-basic-self-test/: simple test of modules/pysoup/ demonstrating how
   those tools are meant to be used.


Added:
    incubator/triplesoup/code/trunk/modules/
    incubator/triplesoup/code/trunk/modules/pysoup/
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi   (with props)
    incubator/triplesoup/code/trunk/tests/
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh   (with props)
    incubator/triplesoup/code/trunk/tests/FIXTURE.txt   (with props)
    incubator/triplesoup/code/trunk/tests/README.txt   (with props)
    incubator/triplesoup/code/trunk/tests/run.sh   (with props)

Added: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py?view=auto&rev=509187
==============================================================================
    (empty)

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py Mon Feb 19 05:01:11 2007
@@ -0,0 +1,184 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import httplib
+from pysoup import parser
+from HTMLParser import HTMLParser
+from urllib import quote
+import re
+
+class StripHTMLParser(HTMLParser):
+    def handle_data(self,data):
+        data=data.strip()
+        data=data.replace('\n\n', '\n')
+        data=data.replace('  ', ' ')
+        print data
+
+def print_error_response(response):
+    print "  Response:"
+    version = "HTTP/1.0"
+    if response.version == 11:
+        version = "HTTP/1.1"
+    print version, response.status, response.reason
+    for (header,value) in response.getheaders():
+        print "%s: %s" % (header,value)
+    print
+    p = StripHTMLParser()
+    p.feed(response.read())
+    p.close()
+
+class ErrorListener:
+    def error(self, statuscode, http_response):
+        pass
+
+class CommandHandler:
+    format="RDF/XML"
+    host="localhost"
+    debug_level=1
+    readpath="/pysoup/get.cgi"
+    editpath="/pysoup/edit.cgi"
+    adminpath="/pysoup/admin.cgi"
+    
+    def __init__(self,error_listener=ErrorListener()):
+        self.error_listener=error_listener
+    
+    def load_data(self,dbname,filename):
+        print 'LOAD DATA INFILE "%s" INTO DATABASE %s; /* host: %s */' % (filename, dbname, self.host)
+        data=open(filename).read()
+        path="%s?dbname=%s&format=%s" % (self.editpath,quote(dbname),quote(self.format))
+        
+        conn = httplib.HTTPConnection(self.host)
+        try:
+            if self.debug_level > 2:
+                print "  Request:"
+                print "POST %s HTTP/1.0" % (path,)
+                print ""
+                print data
+            conn.request("POST", path, data)
+            response = conn.getresponse()
+            if response.status < 200 or response.status > 299:
+                self.error_listener.error(response.status, response)
+                if self.debug_level == 0:
+                    print "FAILED!"
+                if self.debug_level > 0:
+                    print "  An error occurred..."
+                    print "    Host:   %s" % self.host
+                    print "    Path:   %s" % path
+                    print "    DB:     %s" % dbname
+                    print "    Format: %s" % self.format
+                    print "    Data:   %s" % filename
+                if self.debug_level == 1:
+                    print "    Response:", response.status, response.reason
+                if self.debug_level > 1:
+                    print_error_response(response)
+        finally:
+            conn.close()
+        
+        
+    def create_database(self,dbname):
+        print 'CREATE RDF DATABASE %s; /* host: %s */' % (dbname, self.host)
+        path="%s?action=create_database&dbname=%s" % (self.adminpath,quote(dbname))
+        
+        conn = httplib.HTTPConnection(self.host)
+        try:
+            if self.debug_level > 2:
+                print "  Request:"
+                print "POST %s HTTP/1.0" % (path,)
+                print ""
+            conn.request("POST", path)
+            response = conn.getresponse()
+            if response.status < 200 or response.status > 299:
+                self.error_listener.error(response.status, response)
+                if self.debug_level == 0:
+                    print "FAILED!"
+                if self.debug_level > 0:
+                    print "  An error occurred..."
+                    print "    Host: %s" % self.host
+                    print "    Path: %s" % path
+                    print "    DB: %s" % dbname
+                if self.debug_level == 1:
+                    print "    Response:", response.status, response.reason
+                if self.debug_level > 1:
+                    print_error_response(response)
+            else:
+                print "Created database %s:%s" % (self.host,dbname)
+        finally:
+            conn.close()
+
+    def drop_database(self,dbname):
+        print 'DROP RDF DATABASE %s; /* host: %s */' % (dbname, self.host)
+        path="%s?action=drop_database&dbname=%s" % (self.adminpath,quote(dbname))
+        
+        conn = httplib.HTTPConnection(self.host)
+        try:
+            if self.debug_level > 2:
+                print "  Request:"
+                print "POST %s HTTP/1.0" % (path,)
+                print ""
+            conn.request("POST", path)
+            response = conn.getresponse()
+            if response.status < 200 or response.status > 299:
+                self.error_listener.error(response.status, response)
+                if self.debug_level == 0:
+                    print "FAILED!"
+                if self.debug_level > 0:
+                    print "  An error occurred..."
+                    print "    Host: %s" % self.host
+                    print "    Path: %s" % path
+                    print "    DB: %s" % dbname
+                if self.debug_level == 1:
+                    print "    Response:", response.status, response.reason
+                if self.debug_level > 1:
+                    print_error_response(response)
+            else:
+                print "Dropped database %s:%s" % (self.host,dbname)
+        finally:
+            conn.close()
+
+    def set_property(self,key,value):
+        print 'SET PROPERTY %s = "%s";' % (key, value)
+        if key == "rdf_format":
+            self.format=value
+        elif key == "host":
+            self.host=value
+        elif key == "debug_level":
+            debugno=int(value)
+            if debugno < 0 or debugno > 9:
+                raise "debug level should be between 0 and 9"
+            self.debug_level = debugno
+        else:
+            raise "unknown property %s" % (key,)
+
+def run_script(filename):
+    print 'Running script "%s"' % (filename,)
+    script=open(filename).read()
+    
+    class MyErrorListener(ErrorListener):
+        exit_status = 0
+        def error(self, responsecode, http_response):
+            self.exit_status = 1
+    
+    listener=MyErrorListener()
+    
+    parser.run(script, CommandHandler(listener))
+    return listener.exit_status
+
+if __name__=="__main__":
+    import sys
+    for script in sys.argv[1:]:
+        exit_status = run_script(script)
+        sys.exit(exit_status)
\ No newline at end of file

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py Mon Feb 19 05:01:11 2007
@@ -0,0 +1,384 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Silly example parser for a limited version of SQL-like RDF manipulation statements.
+
+Supported syntax:
+
+  CREATE RDF DATABASE <dbname>;
+  DROP RDF DATABASE <dbname>;
+  SET <property>=<value>;
+  /* c-style comments */
+  LOAD DATA INFILE <filename> INTO DATABASE <dbname>;
+
+with
+
+  <dbname>   matching [a-zA-Z][a-zA-Z0-9]{1,31}
+  <property> matching [^=]
+  <value>    matching .*
+
+and further
+
+  * support for quoting of <value> using double quotes ""
+    * escape a double quote using a backslash - \"
+    * escape a backslash using another backslash - \\
+    * can embed newlines and the like
+  * no support for nested c-style comments
+    * that means no */ _inside_ of the comment
+  * pretty tolerant of whitespace, newlines, and empty statements
+"""
+
+import re
+
+TS_NORMAL=0
+TS_QUOTED_STRING=1
+TS_C_STYLE_COMMENT=2
+
+T_QUOTED_STRING=0
+T_C_STYLE_COMMENT=1
+T_WORD=2
+T_END_OF_STATEMENT=3
+
+def tokenize(stream):
+    # generator to turn a string-like object (a character generator) into tokens
+    c      = None
+    prevC  = None
+    prevC2 = None
+    state  = TS_NORMAL
+    oldbuf = ""
+    buf    = ""
+    
+    #print """c, prevC, prevC2, state, buf"""
+    for c in stream:
+            #print "%s, %5s, %6s, %5s, %3s" % (c,prevC,prevC2,state,buf)
+            if state == TS_NORMAL:
+                if c == '"':
+                    if prevC=="/":
+                        raise "invalid rogue character /"
+                    # begin-of-quote
+                    # ...also acts as split-token-char
+                    if buf != "":
+                        # got a keyword
+                        yield (T_WORD, buf)
+                        buf   = ""
+                    else:
+                        # ignore-able whitespace
+                        pass
+                    state=TS_QUOTED_STRING
+                elif c =="*":
+                    # might be begin-of-comment
+                    if prevC == "/":
+                        # begin-of-comment
+                        # ...also acts as split-token-char
+                        buf=buf[:-1] # strip appended / of /*
+                        if buf != "":
+                            yield (T_WORD, buf)
+                            buf   = ""
+                        else:
+                            # ignore-able whitespace
+                            buf   = "" # still prepare for comment
+                        state=TS_C_STYLE_COMMENT
+                    else:
+                        # not begin-of-comment
+                        raise "invalid rogue character *"
+                elif c ==" " or c=="\t" or c=="\n":
+                    # split-token-char
+                    if buf != "":
+                        # got a keyword
+                        yield (T_WORD, buf)
+                        buf   = ""
+                    else:
+                        # ignore-able whitespace
+                        pass
+                elif c ==";":
+                    # end-of-statement
+                    # ...also acts as split-token-char
+                    if buf != "":
+                        # got a keyword
+                        yield (T_WORD, buf)
+                        buf   = ""
+                    else:
+                        # ignore-able whitespace
+                        pass
+                    yield (T_END_OF_STATEMENT,)
+                    buf = ""
+                else:
+                    # not special-case, so fill-up-token
+                    buf = buf + c
+                    
+            elif state == TS_QUOTED_STRING:
+                if c == "\\":
+                    if prevC == "\\":
+                        # two backslashes, eg, \\
+                        pass
+                    else:
+                        # just one backslash so far, eg \
+                        buf = buf + c
+                elif c == '"':
+                    # might be end-of-quote
+                    if prevC == "\\":
+                        # might be escaped
+                        if prevC2 == "\\":
+                            # two backslashes followed by quote, eg \\", so end-of-quote
+                            #assert buf.last == "\\"
+                            yield (T_QUOTED_STRING, buf)
+                            buf   = ""
+                            state = TS_NORMAL
+                        else:
+                            # backslash followed by quote, eg \"
+                            # not end-of-quote, so fill-up-quote
+                            buf = buf + c
+                    else:
+                        # not escaped, so end-of-quote
+                        yield (T_QUOTED_STRING, buf)
+                        buf   = ""
+                        state = TS_NORMAL
+                else:
+                    # not end-of-quote, so fill-up-quote
+                    buf = buf + c
+                    
+            elif state == TS_C_STYLE_COMMENT:
+                if c == "/":
+                    # might be end-of-comment
+                    if prevC == "*":
+                        # end-of-comment
+                        yield (T_C_STYLE_COMMENT, buf[:-1].strip()) # strip appended * of */, and strip beginning/trailing whitespace
+                        buf = ""
+                        state = TS_NORMAL
+                    else:
+                        # not end-of-comment, so fill-up-comment
+                        buf = buf + c
+                else:
+                    # not end-of-comment, so fill-up-comment
+                    buf = buf + c
+                    
+            else:
+                raise "invalid state"
+            
+            prevC2=prevC
+            prevC=c
+
+
+def normalize_equals_sign(tokens):
+    # generator to go from [a =] --> [a=]
+    #             and from [a =...] --> [a=...]
+    prev_token = None
+    last_token = None
+    for token in tokens:
+        last_token = token
+        if token[0] == T_WORD and token[1].startswith("="):
+            if not prev_token:
+                raise "illegal syntax: assigning ('=') to void"
+            if not prev_token[0] == T_WORD:
+                raise "illegal syntax: assigning to non-word"
+            if prev_token[1].endswith('='):
+                raise "illegal syntax: double assignment ('==')"
+                
+            prev_token = (prev_token[0], prev_token[1]+token[1])
+        else:
+            to_yield = prev_token
+            prev_token = token
+            if to_yield:
+                yield to_yield
+    yield last_token
+
+
+def normalize_tokens_assignment(tokens):
+    # generator to go from [foo=] [...] -> [foo=...]
+    prev_token = None
+    last_token = None
+    for token in tokens:
+        last_token = token
+        
+        if prev_token:
+            if prev_token[0] == T_WORD:
+                if prev_token[1].endswith("="):
+                    if token[0] == T_QUOTED_STRING or token[0] == T_WORD:
+                        prev_token = (prev_token[0], prev_token[1]+token[1])
+                        token = None
+                    else:
+                        raise "illegal syntax: assignment ('=') followed by %s" % (nexttoken)
+            to_yield = prev_token
+            prev_token = token
+            yield to_yield
+        else:
+            prev_token = token
+            
+    yield last_token
+
+
+def parse_statement(tokens, handler):
+    token = tokens.next()
+    while token[0] == T_C_STYLE_COMMENT or token[0] == T_END_OF_STATEMENT:
+        token = tokens.next()
+        
+    if token[0] != T_WORD:
+        raise "illegal syntax: statement must start with a word"
+    
+    if re.search("^SET$", token[1], re.I):
+        # handle SET <key> = <value>;
+        token = tokens.next()
+        if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+            raise "illegal syntax: statement must start with a word"
+        
+        result=re.search("^([^=]+)=(.*)", token[1], re.S).groups()
+        if not result:
+            raise "illegal syntax: SET must be followed by key = value"
+        (key,value)=result
+        
+        token = tokens.next()
+        if not token[0] == T_END_OF_STATEMENT:
+            raise "illegal syntax: SET statement missing terminating ';'"
+        
+        handler.set_property(key, value)
+    elif re.search("^CREATE$", token[1], re.I):
+        token = tokens.next()
+        if token[0] != T_WORD:
+            raise "illegal syntax: CREATE must be followed a word"
+        if re.search("^RDF$", token[1], re.I):
+            token = tokens.next()
+            if token[0] != T_WORD:
+                raise "illegal syntax: CREATE RDF must be followed a word"
+            if re.search("^DATABASE$", token[1], re.I):
+                # handle CREATE RDF DATABASE <name>;
+                token = tokens.next()
+                if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+                    raise "illegal syntax: CREATE RDF DATABASE must be followed by a database name"
+                if not re.search("^[a-zA-Z][a-zA-Z0-9]{1,31}$", token[1], re.I):
+                    raise "illegal syntax: bad database name %s" % (token[1],)
+                dbname=token[1]
+                token = tokens.next()
+                if not token[0] == T_END_OF_STATEMENT:
+                    raise "illegal syntax: CREATE RDF DATABASE statement missing terminating ';'"
+                handler.create_database(dbname)
+            else:
+                raise "illegal syntax: don't know how to create %s" % (token[1],)
+        else:
+            raise "illegal syntax: don't know how to create %s" % (token[1],)
+    elif re.search("^DROP$", token[1], re.I):
+        token = tokens.next()
+        if token[0] != T_WORD:
+            raise "illegal syntax: DROP must be followed a word"
+        if re.search("^RDF$", token[1], re.I):
+            token = tokens.next()
+            if token[0] != T_WORD:
+                raise "illegal syntax: DROP RDF must be followed a word"
+            if re.search("^DATABASE$", token[1], re.I):
+                # handle CREATE RDF DATABASE <name>;
+                token = tokens.next()
+                if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+                    raise "illegal syntax: DROP RDF DATABASE must be followed by a database name"
+                if not re.search("^[a-zA-Z][a-zA-Z0-9]{1,31}$", token[1], re.I):
+                    raise "illegal syntax: bad database name %s" % (token[1],)
+                dbname=token[1]
+                token = tokens.next()
+                if not token[0] == T_END_OF_STATEMENT:
+                    raise "illegal syntax: DROP RDF DATABASE statement missing terminating ';'"
+                handler.drop_database(dbname)
+            else:
+                raise "illegal syntax: don't know how to drop %s" % (token[1],)
+        else:
+            raise "illegal syntax: don't know how to drop %s" % (token[1],)
+    elif re.search("^LOAD$", token[1], re.I):
+        token = tokens.next()
+        if not re.search("^DATA$", token[1], re.I):
+            raise "illegal syntax: LOAD must be followed by DATA"
+        token = tokens.next()
+        if not re.search("^INFILE$", token[1], re.I):    
+            raise "illegal syntax: LOAD DATA must be followed by INFILE"
+        
+        token = tokens.next()
+        if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+            raise "illegal syntax: LOAD DATA INFILE must be followed by a file name"
+        filename=token[1]
+        
+        token = tokens.next()
+        if token[0] != T_WORD or not re.search("^INTO$", token[1], re.I):
+            raise "illegal syntax: LOAD DATA INFILE <filename> must be followed by INTO"
+        token = tokens.next()
+        if token[0] != T_WORD or not re.search("^DATABASE$", token[1], re.I):
+            raise "illegal syntax: LOAD DATA INFILE <filename> INTO must be followed by DATABASE"
+        
+        token = tokens.next()
+        if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+            raise "illegal syntax: LOAD DATA INFILE <filename> INTO DATABASE must be followed by database name"
+        if not re.search("^[a-zA-Z][a-zA-Z0-9]{1,31}$", token[1], re.I):
+            raise "illegal syntax: bad database name %s" % (token[1],)
+        dbname=token[1]
+                
+        token = tokens.next()
+        if not token[0] == T_END_OF_STATEMENT:
+            raise "illegal syntax: LOAD DATA INFILE statement missing terminating ';'"
+        
+        handler.load_data(dbname, filename)
+    else:
+        raise "illegal syntax: don't know how to %s" % (token[1],)
+
+
+def parse(tokens, handler):
+    try:
+        while True:
+            parse_statement(tokens, handler)
+    except StopIteration:
+        pass
+
+def run(script, handler):
+    parse(normalize_tokens_assignment(normalize_equals_sign(tokenize(script))), handler)
+
+
+if __name__=="__main__":
+    # basic self-test...
+    commands="""
+/* Set the debug level to
+   1 to get *verbose* output... */
+SET debug_level =1;
+
+/* Set the rdf format default to N3 for this session */
+set rdf_format  =     "rdf/n3";
+
+CREATE RDF DATABASE test1;
+LOAD DATA INFILE 
+          "foo.n3" INTO DATABASE test1;
+DROP RDF DATABASE test1;
+"""
+    tokens=normalize_tokens_assignment(normalize_equals_sign(tokenize(commands)))
+
+    class Handler:
+        def load_data(self,dbname,filename):
+            if not dbname == "test1" or not filename == "foo.n3":
+                raise "test FAILED"
+            #print 'load_data("%s","%s")' % (dbname, filename)
+
+        def create_database(self,dbname):
+            if not dbname == "test1":
+                raise "test FAILED"
+            #print 'create_database("%s")' % (dbname,)
+
+        def drop_database(self,dbname):
+            if not dbname == "test1":
+                raise "test FAILED"
+            #print 'drop_database("%s")' % (dbname,)
+
+        def set_property(self,key,value):
+            if not key in ["debug_level", "rdf_format"]:
+                raise "test FAILED"
+            if not value in ["1", "rdf/n3"]:
+                raise "test FAILED"
+            #print 'set_property("%s","""%s""")' % (key,value)
+
+    run(commands, Handler())

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi Mon Feb 19 05:01:11 2007
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import cgi
+import cgitb; cgitb.enable()
+
+print "Status: 500 Internal Server Error"
+print "Content-Type: text/plain\n"
+
+print "Sorry, server not yet implemented.\n"

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi Mon Feb 19 05:01:11 2007
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import cgi
+import cgitb; cgitb.enable()
+
+print "Status: 500 Internal Server Error"
+print "Content-Type: text/plain\n"
+
+print "Sorry, server not yet implemented.\n"

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi Mon Feb 19 05:01:11 2007
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import cgi
+import cgitb; cgitb.enable()
+
+print "Status: 500 Internal Server Error"
+print "Content-Type: text/plain\n"
+
+print "Sorry, server not yet implemented.\n"

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql (added)
+++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql Mon Feb 19 05:01:11 2007
@@ -0,0 +1,6 @@
+SET debug_level = 3;
+SET rdf_format = "rdf/n3";
+
+CREATE RDF DATABASE "basicselftest01";
+LOAD DATA INFILE "foaf.n3" INTO DATABASE "basicselftest01";
+DROP RDF DATABASE "basicselftest01";

Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3 (added)
+++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3 Mon Feb 19 05:01:11 2007
@@ -0,0 +1,17 @@
+@keywords a.
+@prefix : <http://xmlns.com/foaf/0.1/>.
+@prefix dc: <http://purl.org/dc/elements/1.1/>.
+@prefix h: <#>.
+
+h:this a PersonalProfileDocument;
+    maker h:me;
+    primaryTopic h:me.
+
+h:me a Person; 
+    homepage <http://www.leosimons.com/>;
+    mbox_sha1sum "61b90cc881bde4eaec17ff510c5bbef16ea7bfed";
+    name "Leo Simons"; 
+    gender "male";
+    title "Mr"; 
+    givenname "Leo";
+    family_name "Simons".

Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh (added)
+++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh Mon Feb 19 05:01:11 2007
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+PYTHONPATH=`pwd`/../../modules/pysoup
+PYTHONPATH=$PYTHONPATH python $PYTHONPATH/pysoup/client.py create-drop-load.tsql || exit 1

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/FIXTURE.txt?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/FIXTURE.txt (added)
+++ incubator/triplesoup/code/trunk/tests/FIXTURE.txt Mon Feb 19 05:01:11 2007
@@ -0,0 +1,11 @@
+These tests need a running pysoup server on localhost; for example, configure
+apache as follows...
+
+	ScriptAlias /pysoup/ "path/to/code/trunk/modules/pysoup/scripts"
+
+	<Directory "path/to/code/trunk/modules/pysoup/scripts">
+	    AllowOverride None
+	    Options None
+	    Order allow,deny
+	    Allow from all
+	</Directory>

Propchange: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/README.txt
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/README.txt?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/README.txt (added)
+++ incubator/triplesoup/code/trunk/tests/README.txt Mon Feb 19 05:01:11 2007
@@ -0,0 +1,29 @@
+Running this test suite
+-----------------------
+
+ * follow any needed steps for test fixture set up; see FIXTURE.txt
+
+ * run using a simple
+
+   ./run.sh
+
+
+Writing a test
+--------------
+
+ * Create a new test directory following the established naming pattern.
+
+   * do not name the directory starting with a "_"
+
+ * Add a script file called run.sh into that directory.
+
+   * Invoke whatever you want from that file to run the test.
+
+   * use "exit 1" to indicate a test FAILURE
+
+   * use "exit 2" to indicate a test NO RESULT (when a missing precondition
+     means its not possible to run the test)
+
+   * use "exit 0" to indicate a test SUCCESS
+
+ * the main run.sh will pick up the new test automatically.

Propchange: incubator/triplesoup/code/trunk/tests/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/README.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/run.sh
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/run.sh?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/run.sh (added)
+++ incubator/triplesoup/code/trunk/tests/run.sh Mon Feb 19 05:01:11 2007
@@ -0,0 +1,69 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+tests=`find . -type d -mindepth 1 -maxdepth 1 -not -name '_*' -not -name '.svn' | sort`
+
+exitstatus=0
+failed=0
+success=0
+noresult=0
+total=0
+log=""
+
+for test in $tests; do
+    total=$(( $total + 1 ))
+    echo "Running $test..."
+    cd $test
+    ./run.sh
+    myexitstatus=$?
+    msg="SUCCESS"
+    if [[ $myexitstatus -ne 0 ]]; then
+        exitstatus=$myexitstatus
+        if [[ $myexitstatus -eq 2 ]]; then
+            noresult=$(( $noresult + 1 ))
+            msg="NO RESULT"
+        else
+            failed=$(( $failed + 1 ))
+            msg="FAILED"
+        fi
+    else
+        success=$(( $success + 1 ))
+    fi
+    cd ..
+    log="$log
+$test...$msg"
+done
+
+cat <<END
+
+
+Test report
+-----------------------------------------------------$log
+
+Test summary
+-----------------------------------------------------
+Successes:     `printf %02d $success`
+Failures:      `printf %02d $failed`
+No results:    `printf %02d $noresult`
+               --
+        Total: `printf %02d $total`
+-----------------------------------------------------
+END
+
+exit $exitstatus

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Re: testing stuff over HTTP

Posted by David Reid <da...@jetnet.co.uk>.
Garrett Rooney wrote:
> On 2/19/07, Leo Simons <ma...@leosimons.com> wrote:
>> On Feb 19, 2007, at 3:42 PM, David Reid wrote:
>> >> Obviously we want to use SPARQL for all the data fetching, but we
>> >> also
>> >> need to put the stuff in there to fetch, otherwise how can we test
>> >> properly? :-)
>> >
>> > Well, how about having an sqllite database (single file) that we can
>> > populate and then store in SVN?
>>
>> That could work...if you look at what others have mostly done for
>> tests, they're either storing RDF/XML or RDF/N3...which I can
>> understand, since the human-readable-ness is nice for diffs and the
>> like...maybe storing the sqldump would get us the same...in any case,
>> we should leech all those existing tests and use them if we can! :-)
> 
> I would worry about using a sqlite db simply because changes to the
> tests would not show up as diffs in svn commits.  If you use a textual
> format (perhaps sucked into sqlite to run the tests) it's a lot more
> transparent and encourages more review of changes.

Good point.

Maybe we should aim for having the RDF data as RDF/turtle and also as
some form of SQL dump. Ideally the SQL dump could then be read by
multiple db's (not sure if this is even possible) but that would mean we
could test more aspects and should simplify the initial setting up.

> 
>> > As for httpd, we could have a config file that set it up specifically
>> > for the tests, again stored in SVN. Part of the configure step
>> > could be
>> > to find the httpd executable (and check the version I guess). In fact
>> > mod_sparql currently uses apxs, so this will probably be required
>> > anyways.
> 
> Are we just reinventing the Apache::Test wheel here?  The mod_perl
> guys have had this solved in a rock-solid way for quite some time.  I
> realize some people in the room are not the biggest fans of perl, but
> Apache:Test is really really slick...

If there's something out there that can simplify things and reduce the
amount of effort required I'm all for it :-) at the very least we need
to document what we need for the setup, so maybe starting a doc
explaining that would be a start?

Re: testing stuff over HTTP

Posted by Leo Simons <ma...@leosimons.com>.
On Feb 19, 2007, at 11:49 PM, Garrett Rooney wrote:
> The point of Apache::Test is that it handles all the configuration and
> running of apache httpd, which gets more important when you're talking
> about testing things like mod_sparql.  Check out the test setup for
> mod_speedyfeed here:
>
> http://svn.apache.org/repos/asf/labs/speedyfeed/mod_speedyfeed/trunk/
>
> Specifically, the contents of the t directory, TEST.PL is the main
> driver program, and there's a few tests and some simple httpd config
> glue that Apache::Test reads for you.  Plus a few actual test scripts,
> of course.  See the check: and related targets in Makefile.in to see
> how it's actually driven.

Thanks Garrett, that makes a *lot* more sense than what I learned  
from googling. Let's do it this way, too :)

/me is recompiling perl and p5-* in the background...I might even  
write a little howto for other people like me...

- Leo


Re: testing stuff over HTTP

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 2/19/07, Leo Simons <ma...@leosimons.com> wrote:
> On Feb 19, 2007, at 7:30 PM, Garrett Rooney wrote:
> > Are we just reinventing the Apache::Test wheel here?
>
> Hey, that sounds like fun, maybe we should! Though I'm rather
> confident Apache::Test doesn't have a RDF command language, and these
> few scripts I did certainly don't have load testing or other fancy
> features ;-)
>
> >   The mod_perl
> > guys have had this solved in a rock-solid way for quite some time.  I
> > realize some people in the room are not the biggest fans of perl, but
> > Apache:Test is really really slick...
>
> Regardless of the relative merits of perl, Apache::Test is not
> exactly userfriendly from where I'm sitting. I just spent over an
> hour and a half trying to learn about Apache::Test and I still don't
> even have a "hello, world!" equivalent running. Frustration! It fails
> my personal "simple things should be simple" test...
>
> it took me a lot less time to just write...
>
>    http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/
> modules/pysoup/pysoup/client.py
>    http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/
> tests/run.sh
>
> ...which seems to be roughly wherein the overlap with Apache::Test is
> contained.
>
> But of course I'm happy to see things done "properly"! If someone
> could help make it easy enough for me to write roughly things like
>
>    http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/
> tests/01-basic-self-test/create-drop-load.tsql
>    http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/
> tests/01-basic-self-test/foaf.n3
>
> in perl (or whatever; I haven't learned a lot of Lua just yet for
> example ;-)), I'll go and reinstall darwinports so that my perl is
> less broken and re-read that entire long boring ill-formatted out-
> dated Apache::Test manual.

The point of Apache::Test is that it handles all the configuration and
running of apache httpd, which gets more important when you're talking
about testing things like mod_sparql.  Check out the test setup for
mod_speedyfeed here:

http://svn.apache.org/repos/asf/labs/speedyfeed/mod_speedyfeed/trunk/

Specifically, the contents of the t directory, TEST.PL is the main
driver program, and there's a few tests and some simple httpd config
glue that Apache::Test reads for you.  Plus a few actual test scripts,
of course.  See the check: and related targets in Makefile.in to see
how it's actually driven.

-garrett

Re: testing stuff over HTTP

Posted by Leo Simons <ma...@leosimons.com>.
On Feb 19, 2007, at 7:30 PM, Garrett Rooney wrote:
> Are we just reinventing the Apache::Test wheel here?

Hey, that sounds like fun, maybe we should! Though I'm rather  
confident Apache::Test doesn't have a RDF command language, and these  
few scripts I did certainly don't have load testing or other fancy  
features ;-)

>   The mod_perl
> guys have had this solved in a rock-solid way for quite some time.  I
> realize some people in the room are not the biggest fans of perl, but
> Apache:Test is really really slick...

Regardless of the relative merits of perl, Apache::Test is not  
exactly userfriendly from where I'm sitting. I just spent over an  
hour and a half trying to learn about Apache::Test and I still don't  
even have a "hello, world!" equivalent running. Frustration! It fails  
my personal "simple things should be simple" test...

it took me a lot less time to just write...

   http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/ 
modules/pysoup/pysoup/client.py
   http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/ 
tests/run.sh

...which seems to be roughly wherein the overlap with Apache::Test is  
contained.

But of course I'm happy to see things done "properly"! If someone  
could help make it easy enough for me to write roughly things like

   http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/ 
tests/01-basic-self-test/create-drop-load.tsql
   http://svn.apache.org/repos/asf/incubator/triplesoup/code/trunk/ 
tests/01-basic-self-test/foaf.n3

in perl (or whatever; I haven't learned a lot of Lua just yet for  
example ;-)), I'll go and reinstall darwinports so that my perl is  
less broken and re-read that entire long boring ill-formatted out- 
dated Apache::Test manual.

g'night!

/LSD


Re: testing stuff over HTTP

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 2/19/07, Leo Simons <ma...@leosimons.com> wrote:
> On Feb 19, 2007, at 3:42 PM, David Reid wrote:
> >> Obviously we want to use SPARQL for all the data fetching, but we
> >> also
> >> need to put the stuff in there to fetch, otherwise how can we test
> >> properly? :-)
> >
> > Well, how about having an sqllite database (single file) that we can
> > populate and then store in SVN?
>
> That could work...if you look at what others have mostly done for
> tests, they're either storing RDF/XML or RDF/N3...which I can
> understand, since the human-readable-ness is nice for diffs and the
> like...maybe storing the sqldump would get us the same...in any case,
> we should leech all those existing tests and use them if we can! :-)

I would worry about using a sqlite db simply because changes to the
tests would not show up as diffs in svn commits.  If you use a textual
format (perhaps sucked into sqlite to run the tests) it's a lot more
transparent and encourages more review of changes.

> > As for httpd, we could have a config file that set it up specifically
> > for the tests, again stored in SVN. Part of the configure step
> > could be
> > to find the httpd executable (and check the version I guess). In fact
> > mod_sparql currently uses apxs, so this will probably be required
> > anyways.

Are we just reinventing the Apache::Test wheel here?  The mod_perl
guys have had this solved in a rock-solid way for quite some time.  I
realize some people in the room are not the biggest fans of perl, but
Apache:Test is really really slick...

-garrett

Re: testing stuff over HTTP

Posted by Leo Simons <ma...@leosimons.com>.
On Feb 19, 2007, at 3:42 PM, David Reid wrote:
>> Obviously we want to use SPARQL for all the data fetching, but we  
>> also
>> need to put the stuff in there to fetch, otherwise how can we test
>> properly? :-)
>
> Well, how about having an sqllite database (single file) that we can
> populate and then store in SVN?

That could work...if you look at what others have mostly done for  
tests, they're either storing RDF/XML or RDF/N3...which I can  
understand, since the human-readable-ness is nice for diffs and the  
like...maybe storing the sqldump would get us the same...in any case,  
we should leech all those existing tests and use them if we can! :-)

> As for httpd, we could have a config file that set it up specifically
> for the tests, again stored in SVN. Part of the configure step  
> could be
> to find the httpd executable (and check the version I guess). In fact
> mod_sparql currently uses apxs, so this will probably be required  
> anyways.

yup. Fortunately, I've done that before:

     http://svn.apache.org/repos/asf/gump/branches/Gump3/webgump/bin/ 
get-apache
     http://svn.apache.org/repos/asf/gump/branches/Gump3/webgump/bin/ 
get-mod-python

better versions of those scripts:

     http://www.jicarilla.nl/dist/jicarilla-devenv/

even better of course:

     FreeBSD ports, but those don't always work well on windoze :-)

...I have to admit this has always been a bit of a hobby of mine...

> I'm trying to figure out an automated test for another project so will
> be watching with interest :-)

Ooh! Here's some stuff for inspiration:

   http://scons.tigris.org/source/browse/scons/trunk/
   http://cvs.savannah.gnu.org/viewcvs/make/tests/?root=make
   http://aegis.sourceforge.net/
   http://svn.apache.org/viewvc/ant/core/trunk/bootstrap.sh? 
revision=439448&view=markup

(build tools mostly always have nicely set up bootstrapping tests)


cheers,


- Leo


Re: testing stuff over HTTP

Posted by David Reid <da...@jetnet.co.uk>.
Leo Simons wrote:
> Hey gang,
> 
> I like testing things. I figure that one of the obvious things to try
> soon is an httpd setup with mod_sparql in the front, redland in the
> back, and then libb way in the back as the backend store for redland.

:-)

Of course for this setup we'd need an apache httpd process.

> 
> We know from some of Andrea's testing that we're likely to run into a
> variety of subtle and not so subtle bugs, so I've been thinking about a
> convenient way to write tests to exercise this chain.

Sounds like a good plan.

> 
> Obviously we want to use SPARQL for all the data fetching, but we also
> need to put the stuff in there to fetch, otherwise how can we test
> properly? :-)

Well, how about having an sqllite database (single file) that we can
populate and then store in SVN?

As for httpd, we could have a config file that set it up specifically
for the tests, again stored in SVN. Part of the configure step could be
to find the httpd executable (and check the version I guess). In fact
mod_sparql currently uses apxs, so this will probably be required anyways.

I'm trying to figure out an automated test for another project so will
be watching with interest :-)

> 
> I came up with these bits last night. What do you guys think?
> 
> Note RDFStore also comes with quite a few tests (mostly RDQL not SPARQL)...
> 
>    http://rdfstore.cvs.sourceforge.net/rdfstore/rdfstore/t/
> 
> and there's old RDQL stuff
> 
>    http://www.w3.org/2003/03/rdfqr-tests/test/rdfquery-tests-2003-05.zip
> 
> and then jena has a version of a lot of tests
> 
>    http://jena.cvs.sourceforge.net/jena/jena2/testing/
> 
> (also holds the DAWG tests
> 
>    http://www.w3.org/2001/sw/DataAccess/tests/
> 
> ).
> 
> cheers!
> 
> - Leo
> 
> Begin forwarded message:
>>     incubator/triplesoup/code/trunk/tests/01-basic-self-test/
>>    
>> incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
>>
>>     incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
>>     incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh  
>> (with props)
> ...
>> Added:
>> incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
>>
>> URL:
>> http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql?view=auto&rev=509187
>>
>> ==============================================================================
>>
>> ---
>> incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
>> (added)
>> +++
>> incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
>> Mon Feb 19 05:01:11 2007
>> @@ -0,0 +1,6 @@
>> +SET debug_level = 3;
>> +SET rdf_format = "rdf/n3";
>> +
>> +CREATE RDF DATABASE "basicselftest01";
>> +LOAD DATA INFILE "foaf.n3" INTO DATABASE "basicselftest01";
>> +DROP RDF DATABASE "basicselftest01";
>>
>> Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
>> URL:
>> http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3?view=auto&rev=509187
>>
>> ==============================================================================
>>
>> --- incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
>> (added)
>> +++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
>> Mon Feb 19 05:01:11 2007
>> @@ -0,0 +1,17 @@
>> +@keywords a.
>> +@prefix : <http://xmlns.com/foaf/0.1/>.
>> +@prefix dc: <http://purl.org/dc/elements/1.1/>.
>> +@prefix h: <#>.
>> +
>> +h:this a PersonalProfileDocument;
>> +    maker h:me;
>> +    primaryTopic h:me.
>> +
>> +h:me a Person;
>> +    homepage <http://www.leosimons.com/>;
>> +    mbox_sha1sum "61b90cc881bde4eaec17ff510c5bbef16ea7bfed";
>> +    name "Leo Simons";
>> +    gender "male";
>> +    title "Mr";
>> +    givenname "Leo";
>> +    family_name "Simons".
>>
>> Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
>> URL:
>> http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh?view=auto&rev=509187
>>
>> ==============================================================================
>>
>> --- incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
>> (added)
>> +++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
>> Mon Feb 19 05:01:11 2007
> ...
>> +PYTHONPATH=`pwd`/../../modules/pysoup
>> +PYTHONPATH=$PYTHONPATH python $PYTHONPATH/pysoup/client.py
>> create-drop-load.tsql || exit 1
> ...
>> Added: incubator/triplesoup/code/trunk/tests/run.sh
>> URL:
>> http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/run.sh?view=auto&rev=509187
>>
>> ==============================================================================
>>
>> --- incubator/triplesoup/code/trunk/tests/run.sh (added)
>> +++ incubator/triplesoup/code/trunk/tests/run.sh Mon Feb 19 05:01:11 2007
>> @@ -0,0 +1,69 @@
>> +#!/usr/bin/env bash
> ...
>> +cat <<END
>> +
>> +
>> +Test report
>> +-----------------------------------------------------$log
>> +
>> +Test summary
>> +-----------------------------------------------------
>> +Successes:     `printf %02d $success`
>> +Failures:      `printf %02d $failed`
>> +No results:    `printf %02d $noresult`
>> +               --
>> +        Total: `printf %02d $total`
>> +-----------------------------------------------------
>> +END
> 


testing stuff over HTTP

Posted by Leo Simons <ma...@leosimons.com>.
Hey gang,

I like testing things. I figure that one of the obvious things to try  
soon is an httpd setup with mod_sparql in the front, redland in the  
back, and then libb way in the back as the backend store for redland.

We know from some of Andrea's testing that we're likely to run into a  
variety of subtle and not so subtle bugs, so I've been thinking about  
a convenient way to write tests to exercise this chain.

Obviously we want to use SPARQL for all the data fetching, but we  
also need to put the stuff in there to fetch, otherwise how can we  
test properly? :-)

I came up with these bits last night. What do you guys think?

Note RDFStore also comes with quite a few tests (mostly RDQL not  
SPARQL)...

    http://rdfstore.cvs.sourceforge.net/rdfstore/rdfstore/t/

and there's old RDQL stuff

    http://www.w3.org/2003/03/rdfqr-tests/test/rdfquery- 
tests-2003-05.zip

and then jena has a version of a lot of tests

    http://jena.cvs.sourceforge.net/jena/jena2/testing/

(also holds the DAWG tests

    http://www.w3.org/2001/sw/DataAccess/tests/

).

cheers!

- Leo

Begin forwarded message:
>     incubator/triplesoup/code/trunk/tests/01-basic-self-test/
>     incubator/triplesoup/code/trunk/tests/01-basic-self-test/create- 
> drop-load.tsql
>     incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
>     incubator/triplesoup/code/trunk/tests/01-basic-self-test/ 
> run.sh   (with props)
...
> Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/ 
> create-drop-load.tsql
> URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/ 
> tests/01-basic-self-test/create-drop-load.tsql?view=auto&rev=509187
> ====================================================================== 
> ========
> --- incubator/triplesoup/code/trunk/tests/01-basic-self-test/create- 
> drop-load.tsql (added)
> +++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/create- 
> drop-load.tsql Mon Feb 19 05:01:11 2007
> @@ -0,0 +1,6 @@
> +SET debug_level = 3;
> +SET rdf_format = "rdf/n3";
> +
> +CREATE RDF DATABASE "basicselftest01";
> +LOAD DATA INFILE "foaf.n3" INTO DATABASE "basicselftest01";
> +DROP RDF DATABASE "basicselftest01";
>
> Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/ 
> foaf.n3
> URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/ 
> tests/01-basic-self-test/foaf.n3?view=auto&rev=509187
> ====================================================================== 
> ========
> --- incubator/triplesoup/code/trunk/tests/01-basic-self-test/ 
> foaf.n3 (added)
> +++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/ 
> foaf.n3 Mon Feb 19 05:01:11 2007
> @@ -0,0 +1,17 @@
> +@keywords a.
> +@prefix : <http://xmlns.com/foaf/0.1/>.
> +@prefix dc: <http://purl.org/dc/elements/1.1/>.
> +@prefix h: <#>.
> +
> +h:this a PersonalProfileDocument;
> +    maker h:me;
> +    primaryTopic h:me.
> +
> +h:me a Person;
> +    homepage <http://www.leosimons.com/>;
> +    mbox_sha1sum "61b90cc881bde4eaec17ff510c5bbef16ea7bfed";
> +    name "Leo Simons";
> +    gender "male";
> +    title "Mr";
> +    givenname "Leo";
> +    family_name "Simons".
>
> Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
> URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/ 
> tests/01-basic-self-test/run.sh?view=auto&rev=509187
> ====================================================================== 
> ========
> --- incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh  
> (added)
> +++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh  
> Mon Feb 19 05:01:11 2007
...
> +PYTHONPATH=`pwd`/../../modules/pysoup
> +PYTHONPATH=$PYTHONPATH python $PYTHONPATH/pysoup/client.py create- 
> drop-load.tsql || exit 1
...
> Added: incubator/triplesoup/code/trunk/tests/run.sh
> URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/ 
> tests/run.sh?view=auto&rev=509187
> ====================================================================== 
> ========
> --- incubator/triplesoup/code/trunk/tests/run.sh (added)
> +++ incubator/triplesoup/code/trunk/tests/run.sh Mon Feb 19  
> 05:01:11 2007
> @@ -0,0 +1,69 @@
> +#!/usr/bin/env bash
...
> +cat <<END
> +
> +
> +Test report
> +-----------------------------------------------------$log
> +
> +Test summary
> +-----------------------------------------------------
> +Successes:     `printf %02d $success`
> +Failures:      `printf %02d $failed`
> +No results:    `printf %02d $noresult`
> +               --
> +        Total: `printf %02d $total`
> +-----------------------------------------------------
> +END