<commit_before>// __Dependencies__
var mongoose = require('mongoose');
var express = require('express');
var baucis = require('baucis');
var compression = require('compression');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var config = require('./config');
var models = require('../../../app/model');

// __Private Module Members__
var app;
var server;

// __Module Definition__
var fixture = module.exports = {
    init: function (done) {
		var dbCnx = (process.env.DB_SERVER) 
				? "mongodb://"+process.env.DB_SERVER+"/eventBackendTest"  //DB passed from event var.
				: config.mongo.url; //Local config
        mongoose.connect(dbCnx);
        
        app = express();

        //Configure app ------------------------------------
        app.use(compression({
            threshold: 512
        }));
        app.use(bodyParser.urlencoded({
            extended: true,
            limit: '50mb'
        }));
        app.use(bodyParser.json({
            limit: '50mb'
        }));
        app.use(cookieParser());

        // Create the API routes & controllers  ---------------------------
        fixture.controllers = [];
        Object.keys(models.models).forEach(function (key) {
            var item = models.models[key];
            var controller = baucis.rest(item.name, item.model).hints(true).comments(true);
            item.controller = controller;
            fixture.controllers.push(controller);
        });

        //Add domain services -----------------------------------------------
        require('../../../app/services/relationsHooks').apply(models);
        //---------------------------------------------------------------------
<commit_msg>change to CreateConnection for tests<commit_after>// __Dependencies__
var mongoose = require('mongoose');
var express = require('express');
var baucis = require('baucis');
var compression = require('compression');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var config = require('./config');
var models = require('../../../app/model');

// __Private Module Members__
var app;
var server;

// __Module Definition__
var fixture = module.exports = {
    init: function (done) {
		var dbCnx = (process.env.DB_SERVER) 
				? "mongodb://"+process.env.DB_SERVER+"/eventBackendTest"  //DB passed from event var.
				: config.mongo.url; //Local config

		//mongoose.connect(dbCnx);
		mongoose.createConnection(dbCnx);
        
        app = express();

        //Configure app ------------------------------------
        app.use(compression({
            threshold: 512
        }));
        app.use(bodyParser.urlencoded({
            extended: true,
            limit: '50mb'
        }));
        app.use(bodyParser.json({
            limit: '50mb'
        }));
        app.use(cookieParser());

        // Create the API routes & controllers  ---------------------------
        fixture.controllers = [];
        Object.keys(models.models).forEach(function (key) {
            var item = models.models[key];
            var controller = baucis.rest(item.name, item.model).hints(true).comments(true);
            item.controller = controller;
            fixture.controllers.push(controller);
        });

        //Add domain services -----------------------------------------------
        require('../../../app/services/relationsHooks').apply(models);
        //---------------------------------------------------------------------

{'fraction_non_alphanumeric': 0.2359357060849598, 'fraction_numerical': 0.004018369690011481, 'mean_word_length': 1.6973684210526316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '504734', 'n_tokens_mistral': 906, 'n_tokens_neox': 883, 'n_words': 189}