Beispiel #1
0
def setUpModule():
    """Create database and tables."""
    global compmgr, userscomp, liccomp, attcomp, syscomp, projcomp, wikicomp, \
           tckcomp, revcomp, xicomp, cachemgr

    testdir = os.path.basename(os.path.dirname(__file__))
    testfile = os.path.basename(__file__)
    seed = config['seed'] and int(config['seed']) or genseed()
    log_mheader(log, testdir, testfile, seed)
    random.seed(seed)

    info = "   Creating models (module-level) ... "
    log.info(info)
    print info
    # Setup SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    # init_model( engine )
    create_models(engine,
                  config,
                  sysentries_cfg=meta.sysentries_cfg,
                  permissions=permissions)
    compmgr = config['compmgr']
    userscomp = config['userscomp']
    liccomp = LicenseComponent(compmgr)
    syscomp = SystemComponent(compmgr)
    attcomp = AttachComponent(compmgr)
    projcomp = ProjectComponent(compmgr)
    wikicomp = WikiComponent(compmgr)
    tckcomp = TicketComponent(compmgr)
    revcomp = ReviewComponent(compmgr)
    xicomp = XInterfaceComponent(compmgr)

    # Populate DataBase with sample entries
    print "   Populating permissions ..."
    pop_permissions(seed=seed)
    print "   Populating users ( no_of_users=%s, no_of_relations=%s ) ..." % \
                ( no_of_users, no_of_relations )
    pop_user(no_of_users, no_of_relations, seed=seed)
    print "   Populating licenses ( no_of_tags=%s, no_of_attachs=%s ) ..." % \
                ( no_of_tags, no_of_attachs )
    pop_licenses(no_of_tags, no_of_attachs, seed=seed)
    print "   Populating projects ( no_of_projects=%s ) ..." % no_of_projects
    pop_projects(no_of_projects, no_of_tags, no_of_attachs, seed=seed)
    print "   Populating tickets ( no_of_tickets=%s ) ..." % no_of_tickets
    pop_tickets(no_of_tickets, no_of_tags, no_of_attachs, seed=seed)
    print "   Populating vcs ( no_of_vcs=%s ) ..." % no_of_vcs
    pop_vcs(no_of_vcs=no_of_vcs, seed=seed)
    print "   Populating wikis ( no_of_wikis=%s ) ..." % no_of_wikis
    pop_wikipages(no_of_tags, no_of_attachs, seed=seed)
    print "   Populating reviews ( no_of_reviews=%s ) ..." % no_of_reviews
    pop_reviews(no_of_reviews, no_of_tags, no_of_attachs, seed=seed)
    print ( "   no_of_users=%s, no_of_relations=%s, no_of_tags=%s, " + \
            "no_of_attach=%s, no_of_projects=%s, no_of_reviews=%s" ) % \
          ( no_of_users, no_of_relations, no_of_tags, no_of_attachs,
            no_of_projects, no_of_reviews )

    # Setup cache manager
    isdir(cachedir) or os.makedirs(cachedir)
    cachemgr = cachemod.cachemanager(cachedir)
    config['cachemgr'] = cachemgr
Beispiel #2
0
def setUpModule() :
    """Create database and tables."""
    global compmgr, userscomp, tagcomp, attachcomp, projcomp, wikicomp, wikidata, \
           votcomp, zwparser, seed, cachemgr

    testdir  = os.path.basename( os.path.dirname( __file__ ))
    testfile = os.path.basename( __file__ )
    seed     = config['seed'] and int(config['seed']) or genseed()
    log_mheader( log, testdir, testfile, seed )
    random.seed( seed )
    info = "   Creating models (module-level) ... "
    log.info( info )
    print info
    # Setup SQLAlchemy database engine
    engine  = engine_from_config( config, 'sqlalchemy.' )
    # init_model( engine )
    create_models( engine, config, sysentries_cfg=meta.sysentries_cfg, 
                   permissions=permissions )
    compmgr    = config['compmgr']
    userscomp  = config['userscomp']
    tagcomp    = TagComponent( compmgr )
    attachcomp = AttachComponent( compmgr )
    projcomp   = ProjectComponent( compmgr )
    wikicomp   = WikiComponent( compmgr )
    votcomp    = VoteComponent( compmgr )
    # Populate DataBase with sample entries
    print "   Populating permissions ..."
    pop_permissions( seed=seed )
    print "   Populating users ( no_of_users=%s, no_of_relations=%s ) ..." % \
                ( no_of_users, no_of_relations )
    pop_user( no_of_users, no_of_relations, seed=seed )
    print "   Populating licenses ( no_of_tags=%s, no_of_attachs=%s ) ..." % \
                ( no_of_tags, no_of_attachs )
    pop_licenses( no_of_tags, no_of_attachs, seed=seed )
    print "   Populating projects ( no_of_projects=%s ) ..." % no_of_projects
    pop_projects( no_of_projects, no_of_tags, no_of_attachs, seed=seed )
    print "   Populating tickets ( no_of_tickets=%s ) ..." % no_of_tickets
    pop_tickets( no_of_tickets, no_of_tags, no_of_attachs, seed=seed )
    print "   Populating vcs ( no_of_vcs=%s ) ..." % no_of_vcs
    pop_vcs( no_of_vcs=no_of_vcs, seed=seed )
    print "   Populating reviews ( no_of_reviews=%s ) ..." % no_of_reviews
    pop_reviews( no_of_reviews, no_of_tags, no_of_attachs, seed=seed )
    # Collect the expected database objects.
    wikidata = gen_wiki( no_of_tags, no_of_attachs, seed=seed )
    print ( "   no_of_users=%s, no_of_relations=%s, no_of_tags=%s, " + \
            "no_of_attach=%s, no_of_projects=%s, no_of_wikis=%s" )   % \
          ( no_of_users, no_of_relations, no_of_tags, no_of_attachs,
            no_of_projects, no_of_wikis )

    zwparser = ZWParser( lex_optimize=True, yacc_debug=True,
                         yacc_optimize=False )

    # Setup cache manager
    isdir( cachedir ) or os.makedirs( cachedir )
    cachemgr = cachemod.cachemanager( cachedir )
    config['cachemgr'] = cachemgr
Beispiel #3
0
def setUpModule():
    """Create database and tables."""
    global compmgr, userscomp, attachcomp, tagcomp, projcomp, tckcomp, taglist,\
           seed, cachemgr

    isdir(dotdir) or os.makedirs(dotdir)

    testdir = os.path.basename(os.path.dirname(__file__))
    testfile = os.path.basename(__file__)
    seed = config['seed'] and int(config['seed']) or genseed()
    log_mheader(log, testdir, testfile, seed)
    random.seed(seed)
    info = "   Creating models (module-level) ... "
    log.info(info)
    print info
    # Setup SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    # init_model( engine )
    create_models(engine,
                  config,
                  sysentries_cfg=meta.sysentries_cfg,
                  permissions=permissions)
    compmgr = config['compmgr']
    userscomp = config['userscomp']
    attachcomp = AttachComponent(compmgr)
    tagcomp = TagComponent(compmgr)
    liccomp = LicenseComponent(compmgr)
    projcomp = ProjectComponent(compmgr)
    tckcomp = TicketComponent(compmgr)
    taglist = [
        unicode(h.randomname(randint(1, LEN_TAGNAME), tagchars))
        for i in range(randint(1, no_of_tags))
    ]
    # Populate DataBase with sample entries
    print "   Populating permissions ..."
    pop_permissions(seed=seed)
    print "   Populating users ( no_of_users=%s, no_of_relations=%s ) ..." % \
                ( no_of_users, no_of_relations )
    pop_user(no_of_users, no_of_relations, seed=seed)
    print "   Populating licenses ( no_of_tags=%s, no_of_attachs=%s ) ..." % \
                ( no_of_tags, no_of_attachs )
    pop_licenses(no_of_tags, no_of_attachs, seed=seed)
    print "   Populating projects ( no_of_projects=%s ) ..." % no_of_projects
    pop_projects(no_of_projects, no_of_tags, no_of_attachs, seed=seed)
    print "   Populating tickets ( no_of_tickets=%s ) ..." % no_of_tickets
    pop_tickets(no_of_tickets, no_of_tags, no_of_attachs, seed=seed)
    print ( "   no_of_users=%s, no_of_relations=%s, no_of_tags=%s, " + \
            "no_of_attach=%s, no_of_projects=%s, no_of_tickets=%s" ) % \
          ( no_of_users, no_of_relations, no_of_tags, no_of_attachs,
            no_of_projects, no_of_tickets )

    # Setup cache manager
    isdir(cachedir) or os.makedirs(cachedir)
    cachemgr = cachemod.cachemanager(cachedir)
    config['cachemgr'] = cachemgr