def testUrl(url, response, cookiePath):
    log(VERBOSE_, "testApplication: testURL=" + url + "  testResponse=" + response)

    try:
        lines, realCookiePath = readWebPage(url)

        if lines is None or len(lines) == 0:
            log(ERROR_, "testApplication: FAILED CONNECT: url=" + url)
            return false

        found = false
        for line in lines:
            if line.find(response) >= 0:
                found = true
                #endIf
            #endFor
        if found:
            log(INFO_, "testApplication: PASSED: url=" + url + "  contained=" + response)
        else:
            log(ERROR_, "testApplication: WRONG VERSION: url=" + url + "  expectedResponse=" + response)
            sgmlData = extractSgmlData(lines)
            for line in sgmlData:
                log(ERROR_, line)
        if cookiePath and cookiePath != realCookiePath:
            log(ERROR_, "testApplication: WRONG CookiePath: " + realCookiePath + "  expected=" + cookiePath)

        return found


    except IOException, e:
        log(ERROR_, "testApplication: FAILED CONNECT: url=" + url + "  error=" + e.getMessage())
        return false
def testUrls(applicationModels):
    for applicationModel in applicationModels:
        for module in applicationModel.modules:
            for target in module.targets:
                for test in target.tests:
                    print "TRY URL FOR %s (%s): %s" % (applicationModel.name, module.name, test.url)
                    lines, cookiePath = readWebPage(test.url)
                    if lines is None or len(lines) == 0:
                        print "-> FAILED CONNECT FOR: %s" % test.url
                    else:
                        found = 0
                        for line in lines:
                            sgmlData = " ".join(extractSgmlData(line))
                            if sgmlData.find("Version") >= 0 or sgmlData.find("version") >= 0:
                                print "-> SUCCESS, New Version:%s, Current %s" % (applicationModel.version, sgmlData)
                                found = 1
                        if not found:
                            print "-> FAILED, no version found in: %s" % test.url
                        if cookiePath:
                            print "-> CookiePath=%s" % cookiePath
def testUrls(applicationModels):
    for applicationModel in applicationModels:
        for module in applicationModel.modules:
            for target in module.targets:
                for test in target.tests:
                    print "TRY URL FOR %s (%s): %s" % (applicationModel.name,
                                                       module.name, test.url)
                    lines, cookiePath = readWebPage(test.url)
                    if lines is None or len(lines) == 0:
                        print "-> FAILED CONNECT FOR: %s" % test.url
                    else:
                        found = 0
                        for line in lines:
                            sgmlData = " ".join(extractSgmlData(line))
                            if sgmlData.find("Version") >= 0 or sgmlData.find(
                                    "version") >= 0:
                                print "-> SUCCESS, New Version:%s, Current %s" % (
                                    applicationModel.version, sgmlData)
                                found = 1
                        if not found:
                            print "-> FAILED, no version found in: %s" % test.url
                        if cookiePath:
                            print "-> CookiePath=%s" % cookiePath