!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/usr/lib/4Suite/tests/Rdf/Borrowed/   drwxr-xr-x
Free 4.92 GB of 27.03 GB (18.18%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     mb_20041022.py (2.96 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# a basic test of Bag objects, initially based on a 4suite list message
# from Martin Strohal, 2003-07-09

from cStringIO import StringIO
from Ft.Lib.Uri import OsPathToUri
from Ft.Rdf import Model, Container
from Ft.Rdf.Drivers import Memory
from Ft.Rdf.Serializers.Dom import Serializer
from Ft.Xml.Domlette import PrettyPrint
from Ft.Xml.Lib.TreeCompare import TreeCompare

SCOPE = OsPathToUri(__file__, attemptAbsolute=True) + '-INTERNAL-XML-STRING'

CONTAINER_CONTENTS_1 = ['bogus://example.org/testresource1',
                        'bogus://example.org/testresource2']

EXPECTED_MODEL_1 = """<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Bag rdf:ID="%s">
    <rdf:li resource="bogus://example.org/testresource1"/>
    <rdf:li resource="bogus://example.org/testresource2"/>
  </rdf:Bag>
</rdf:RDF>""" % SCOPE

CONTAINER_CONTENTS_2 = ['testliteral1', 'testliteral2']

EXPECTED_MODEL_2 = """<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Bag rdf:ID="%s">
    <rdf:li>testliteral1</rdf:li>
    <rdf:li>testliteral2</rdf:li>
  </rdf:Bag>
</rdf:RDF>""" % SCOPE

# TODO:
#
# Add a test that is a mix of literals and resources.
#
# Change the bag tests so that <rdf:li> item order in the expected
# results doesn't matter.
#
# Add tests for the other types of containers


def getModel():
    db = Memory.CreateDb('')
    return Model.Model(db)


def serializeModel(model):
    serializer = Serializer()
    stream = StringIO()
    doc = serializer.serialize(model)
    PrettyPrint(doc, stream)
    return stream.getvalue()


def Test(tester):
    tester.startGroup('RDF Bag creation and serialization')

    tester.startTest('all items are resources')
    bag = Container.Bag(SCOPE)
    for item in CONTAINER_CONTENTS_1:
        bag.append(item)
    model = getModel()

    # addContainer() turns the bag into statements.
    # The items in the bag become the objects of those statements.
    # What can we do here to ensure that these get serialized as resources?
    #
    # Currently, when converted to statements, the object type is
    # forced to be resource; we have no control over it.
    model.addContainer(bag)

    res = serializeModel(model)
    tester.compare(EXPECTED_MODEL_1, res, func=TreeCompare)
    tester.testDone()

    tester.startTest('all items are literals')
    bag = Container.Bag(SCOPE)
    for item in CONTAINER_CONTENTS_2:
        bag.append(item)
    model = getModel()

    # addContainer() turns the bag into statements.
    # The items in the bag become the objects of those statements.
    # What can we do here to ensure that these get serialized as literals?
    #
    # Currently, when converted to statements, the object type is
    # forced to be resource; we have no control over it.
    model.addContainer(bag)

    res = serializeModel(model)
    tester.compare(EXPECTED_MODEL_2, res, func=TreeCompare)
    tester.testDone()

    tester.groupDone()
    return

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0036 ]--