!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/Server/Client/Core/   drwxr-xr-x
Free 5.06 GB of 27.03 GB (18.73%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_xml_document.py (4.52 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import time

from Ft.Server.Client import FtServerClientException, Error
from Ft.Server.Common import ResourceTypes, Schema, ValidationInfo

import test_helper

def test_create(tester):


    tester.startTest("Create XML Document")

    #Create XML Document
    repo = test_helper.GetRepo(tester)
    test = repo.fetchResource("/test")

    doc = test.createDocument('doc1',DOC1,forcedType=ResourceTypes.ResourceType.XML_DOCUMENT)

    dMd = doc.getMetaDataResource().getContent()
    dContent = doc.getContent()


    tester.compare(ResourceTypes.ResourceType.XML_DOCUMENT,test.hasResource('doc1'))
    tester.compare(doc,test.fetchResource('doc1'))

    tester.compare(ResourceTypes.ResourceType.XML_DOCUMENT,doc.getResourceType())
    tester.compare(1,doc.isResourceType(ResourceTypes.ResourceType.RAW_FILE))
    tester.compare(1,doc.isResourceType(ResourceTypes.ResourceType.XML_DOCUMENT))
    tester.compare(0,doc.isResourceType(ResourceTypes.ResourceType.CONTAINER))
    repo.txCommit()

    repo = test_helper.GetRepo(tester)
    test = repo.fetchResource("/test")
    tester.compare(ResourceTypes.ResourceType.XML_DOCUMENT,test.hasResource('doc1'))
    repo.txRollback()

    repo = test_helper.GetRepo(tester)
    doc = repo.fetchResource("/test/doc1")
    test = repo.fetchResource('/test')
    tester.compare(test,doc.getParent())
    repo.txRollback()
                   
    tester.testDone()
    return




def test_access(tester):

    tester.startTest("XML Document Access")

    repo = test_helper.GetRepo(tester)
    doc = repo.fetchResource("/test/doc1")



    dMd = doc.getMetaDataResource().getContent()
    dContent = doc.getContent()


    tester.compare('text/xml',doc.getImt())
    tester.compare(DOC1,doc.getContent())
    test_helper.CompareValidationInfo(tester,ValidationInfo.NoValidation(),doc.getValidationInfo())
    #Just call, don't test
    doc.getCreationDate()
    doc.getLastModifiedDate()

    repo.txRollback()
    
    tester.testDone()


def test_modify(tester):

    tester.startTest("XML Document Modification")


    repo = test_helper.GetRepo(tester)
    doc = repo.fetchResource("/test/doc1")
    lmd = doc.getLastModifiedDate()
    time.sleep(1)
    doc.setContent(DOC2)

    dMd = doc.getMetaDataResource().getContent()
    dContent = doc.getContent()

    tester.compare(DOC2,doc.getContent())
    repo.txCommit()

    repo = test_helper.GetRepo(tester)
    doc = repo.fetchResource("/test/doc1")
    tester.compare(DOC2,doc.getContent())
    tester.compare(1,doc.getLastModifiedDate() > lmd)
    repo.txRollback()
    
    tester.testDone()


def test_delete(tester):

    tester.startTest("Delete XML Document")
    repo = test_helper.GetRepo(tester)
    doc = repo.fetchResource("/test/doc1")
    fp = doc.getAbsolutePath()
    test = doc.getParent()
    doc.delete()
    tester.compare(0,test.hasResource('doc1'))
    tester.compare(0,len(repo.getModel().complete(fp,None,None)))
    tester.testException(doc.getContent,(),FtServerClientException,{'code':Error.UNKNOWN_PATH})
    repo.txCommit()

    repo = test_helper.GetRepo(tester)
    test = repo.fetchResource("/test")
    tester.compare(0,test.hasResource('doc1'))
    tester.compare(0,len(repo.getModel().complete(fp,None,None)))
    repo.txRollback()

    tester.testDone()

def test_xml_interfaces(tester):

    tester.startTest("XML Document to DOM")
    repo = test_helper.GetRepo(tester)
    test = repo.fetchResource("/test")
    doc1 = test.createDocument('doc1',DOC1,forcedType=ResourceTypes.ResourceType.XML_DOCUMENT)

    dom = doc1.asDom()
    tester.compare('docelem',dom.documentElement.nodeName)
    repo.txCommit()
    tester.testDone()


def cleanup(tester):
    tester.startTest("Clean Up")
    repo = test_helper.GetRepo(tester)
    if repo.hasResource('/test'):
        t = repo.fetchResource('/test')
        t.delete()
    repo.createContainer("/test",1)
    repo.txCommit()
    tester.testDone()


DOC1="""<docelem v='foo'/>"""
DOC2="""<docelem w='foo'/>"""

SHEET1 = """<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/">
  Sheet 1
  </xsl:template>
</xsl:stylesheet>"""

SCHEMA1="""<schema xmlns='http://www.ascc.net/xml/schematron'>
    
  <pattern name='Root'>
    <rule context="/docelem">
      <assert test='@v'>
        VALIDATION ERROR: The root element must have a v attribute
      </assert>      
    </rule>
  </pattern>
  
</schema>"""


def Test(tester):

    cleanup(tester)
    test_create(tester)
    test_access(tester)
    test_modify(tester)
    test_delete(tester)
    test_xml_interfaces(tester)


:: 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 ]--