Exemple #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
Exemple #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
Exemple #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
Exemple #4
0
def setUpModule():
    global compmgr, syscomp, userscomp, projcomp, permission_data, 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 ..."
    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)
    print "   Generating data ..."
    permission_data = gen_pgroups(seed=seed)
    compmgr = config['compmgr']
    userscomp = config['userscomp']
    projcomp = ProjectComponent(compmgr)
    syscomp = SystemComponent(compmgr)
    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)

    # initialize the PMS system
    mapmod = eval_import(config['zeta.pmap.module'])
    permmod.init_pms = eval_import(config['zeta.pmap.mapfunc'])
    permmod.pms_root = permmod.init_pms(ctxt=ctxt)
    permmod.default_siteperms = mapmod.default_siteperms
    permmod.default_projperms = mapmod.default_projperms

    # Setup cache manager
    isdir(cachedir) or os.makedirs(cachedir)
    cachemgr = cachemod.cachemanager(cachedir)
    config['cachemgr'] = cachemgr
Exemple #5
0
def setUpModule():
    global compmgr, vcscomp, 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']
    vcscomp = VcsComponent(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 Vcs ( no_of_vcs=%s ) ..." % no_of_vcs
    pop_vcs(no_of_vcs, seed=seed)

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