Ejemplo n.º 1
0
def main():
    opts, args = getopt.getopt(sys.argv[1:], "")
    if len(args) < 4:
        print "Enter <host> <port> <access> <verify> (access/verify for FMQL RPC)"
        return

    try:
        rpcc = VistARPCConnection(args[0], int(args[1]), args[2], args[3],
                                  "CG FMQL QP USER", DefaultLogger())
    except Exception as e:
        print "Failed to log in to VistA for FMQL RPC (bad parameters?): %s ... exiting" % e
        return

    logger = DefaultLogger()
    qp = FMQLQueryProcessor(rpcc, logger)
    qpe = FMQLQPE(qp, logger)

    queries = [
        "DESCRIBE 2-1", "DESCRIBE 2", "SELECT 2", "COUNT 2",
        "DESCRIBE 2_0361 IN 2-3", "SELECT 2 LIMIT 3 OFFSET 1",
        "SELECT .01 FROM 2 LIMIT 3", "DESCRIBE 79_3 FILTER(.03=2-1)",
        "COUNT 50_68 FILTER(.05=11-2) NOIDXMAX 1"
    ]
    for query in queries:
        print "=========================================================="
        reply = qpe.processQuery({"fmql": [query]})
        # jreply = json.loads(reply["data"])
        print reply
Ejemplo n.º 2
0
def main():

    opts, args = getopt.getopt(sys.argv[1:], "")
    if len(args) < 5:
        print "Enter <host> <port> <access> <verify> (access/verify for FMQL RPC) <fmql host>"
        print "Ex: localhost 9201 'QLFM1234' 'QLFM1234!!' http://www.examplehospital.com/fmqlEP"
        return

    fmqlEP = args[4] + "/fmqlEP"

    try:
        rpcc = VistARPCConnection(args[0], int(args[1]), args[2], args[3],
                                  "CG FMQL QP USER", DefaultLogger())
    except Exception as e:
        print "Failed to log in to VistA (bad parameters?): %s ... exiting" % e
        return

    times = []

    try:

        fails = 0
        total = 0
        testNo = 0
        stopOnFail = True
        for i, testSet in enumerate(TESTSETS, 1):
            for j, testDef in enumerate(testSet["definitions"], 1):
                total += 1
                if not runTest(rpcc, testSet["name"],
                               str(i) + ":" + str(j), testDef):
                    fails += 1
                    if stopOnFail:
                        break
        print "=== All Done: %d of %d failed ===" % (fails, total)

    except Exception as e:
        print "Exception %s" % e
        traceback.print_exc()