Ejemplo n.º 1
0
def test_sysl_diagramm(syslexe):
    name = '020_diagram'
    actual_pattern = path.join(ACTUAL_DIR, name + '-%(epname).svg')
    fname = name + '-SEQ-ATM.svg'
    actual = path.join(ACTUAL_DIR, fname)
    remove_file(actual)
    args = [
        '--root', IN_DIR, 'sd', '-o', actual_pattern, '/' + name, '-a',
        'Bank :: Sequences'
    ]

    if syslexe:
        print 'Sysl exe call'
        call([syslexe] + args)
    else:
        print 'Sysl python function call'
        main(args)

    with open(actual, 'r') as f:
        svg = f.read()

    assert svg.startswith(
        '<?xml version="1.0" encoding="UTF-8" standalone="no"?>')
    assert 'SEQ-ATM: Submit Application (Bankers Desktop)</text>' in svg
    assert 'ATM</text>' in svg
    assert 'AccountTransactionApi</text>' in svg
    assert 'BankDatabase</text>' in svg
    assert 'GetBalance</text>' in svg
    assert 'GET /accounts/{account_number}</text>' in svg
    assert "/accounts/{account_number}/deposit</text>" in svg
    assert '@startuml' in svg
Ejemplo n.º 2
0
def test_sysl_relational_data_diagramm(syslexe):
    name = '020_diagram'
    actual_pattern = path.join(ACTUAL_DIR, name + '-%(epname).svg')
    fname = name + '-BankModel.svg'
    actual = path.join(ACTUAL_DIR, fname)
    remove_file(actual)
    args = ['--root', IN_DIR, 'data', '-o', actual_pattern, '/' + name, '-j', 'Bank :: Relational Views']

    if syslexe:
        print 'Sysl exe call'
        call([syslexe] + args)
    else:
        print 'Sysl python function call'
        main(args)

    with open(actual, 'r') as f:
        svg = f.read()

    assert svg.startswith('<?xml version="1.0" encoding="UTF-8" standalone="no"?>')
    assert 'Account</text>' in svg
    assert 'account_number : int</text>' in svg
    assert 'account_type : string</text>' in svg
    assert 'account_status : string</text>' in svg
    assert 'account_balance : int</text>' in svg
    assert 'Transaction</text>' in svg
    assert 'transaction_id : int</text>' in svg
    assert 'from_account_number :</text>' in svg
    assert 'to_account_number :</text>' in svg
Ejemplo n.º 3
0
def test_e2e(name, syslexe):
    actual = path.join(ACTUAL_DIR, name + '.txt')
    remove_file(actual)

    args = ['--root', IN_DIR, 'textpb', '-o', actual, name + '.sysl']

    if syslexe:
        print 'Sysl exe call'
        call([syslexe] + args)
    else:
        print 'Sysl python function call'
        main(args)

    expected = path.join(EXPECTED_DIR, name + '.txt')
    assert filesAreIdentical(expected, actual)
Ejemplo n.º 4
0
def test_e2e(fname, subprocess):
    e2e_dir = path.normpath(path.dirname(__file__))
    e2e_rel_dir = path.relpath(e2e_dir, start=REPO_ROOT)

    root = path.join(e2e_dir, 'input')
    model = '/' + fname
    out_dir = path.join(REPO_ROOT, 'tmp', e2e_rel_dir)
    out_fname = path.join(out_dir, 'actual_output', fname + '.txt')
    remove_file(out_fname)

    args = ['--root', root, 'textpb', '-o', out_fname, model]

    if subprocess:
        cmd = ['sysl'] + args
        print 'subprocess call: ', ' '.join(cmd)
        call(cmd)
    else:
        print 'python function call: main([{}])'.format(', '.join(args))
        main(args)

    expected_fname = path.join(e2e_dir, 'expected_output', fname + '.txt')
    assert filesAreIdentical(expected_fname, out_fname)