<commit_before>#!/usr/bin/env python
# Copyright (C) 2009-2014:
#    <NAME>, <EMAIL>
#    <NAME>, <EMAIL>
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Shinken is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Shinken.  If not, see <http://www.gnu.org/licenses/>.

#
# This file is used to test reading and processing of config files
#

import os
import tempfile

from shinken_test import *

import shinken.log as shinken_log

from shinken.daemon import InvalidPidFile, InvalidWorkDir
from shinken.http_daemon import PortNotFree

from shinken.daemons.pollerdaemon import Poller
from shinken.daemons.brokerdaemon import Broker
from shinken.daemons.schedulerdaemon import Shinken
from shinken.daemons.reactionnerdaemon import Reactionner
from shinken.daemons.arbiterdaemon import Arbiter
try:
    import pwd, grp
    from pwd import getpwnam
    from grp import getgrnam


    def get_cur_user():
        return pwd.getpwuid(os.getuid()).pw_name

    def get_cur_group():
        return grp.getgrgid(os.getgid()).gr_name

except ImportError, exp:  # Like in nt system or Android
    # temporary workaround:
    def get_cur_user():
        return os.getlogin()

    def get_cur_group():
        return os.getlogin()

curdir = os.getcwd()

daemons_config = {
    Broker:       "etc/core/daemons/brokerd.ini",
    Poller:       "etc/core/daemons/pollerd.ini",
    Reactionner:  "etc/core/daemons/reactionnerd.ini",
    Shinken:      "etc/core/daemons/schedulerd.ini",
    Arbiter:    ["etc/core/shinken.cfg"]
}

import random

HIGH_PORT = random.randint(30000,65000)
run = 0   # We will open some ports but not close them (yes it's not good) and
# so we will open a range from a high port

class template_Daemon_Bad_Start():

    def get_login_and_group(self, p):
        try:<commit_msg>Enh : Test - Set real time for bad_start<commit_after>#!/usr/bin/env python
# Copyright (C) 2009-2014:
#    <NAME>, <EMAIL>
#    <NAME>, <EMAIL>
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Shinken is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Shinken.  If not, see <http://www.gnu.org/licenses/>.

#
# This file is used to test reading and processing of config files
#

import os
import tempfile

from shinken_test import *

import shinken.log as shinken_log

from shinken.daemon import InvalidPidFile, InvalidWorkDir
from shinken.http_daemon import PortNotFree

from shinken.daemons.pollerdaemon import Poller
from shinken.daemons.brokerdaemon import Broker
from shinken.daemons.schedulerdaemon import Shinken
from shinken.daemons.reactionnerdaemon import Reactionner
from shinken.daemons.arbiterdaemon import Arbiter
try:
    import pwd, grp
    from pwd import getpwnam
    from grp import getgrnam


    def get_cur_user():
        return pwd.getpwuid(os.getuid()).pw_name

    def get_cur_group():
        return grp.getgrgid(os.getgid()).gr_name

except ImportError, exp:  # Like in nt system or Android
    # temporary workaround:
    def get_cur_user():
        return os.getlogin()

    def get_cur_group():
        return os.getlogin()

curdir = os.getcwd()

daemons_config = {
    Broker:       "etc/core/daemons/brokerd.ini",
    Poller:       "etc/core/daemons/pollerd.ini",
    Reactionner:  "etc/core/daemons/reactionnerd.ini",
    Shinken:      "etc/core/daemons/schedulerd.ini",
    Arbiter:    ["etc/core/shinken.cfg"]
}

import random

HIGH_PORT = random.randint(30000,65000)
run = 0   # We will open some ports but not close them (yes it's not good) and
# so we will open a range from a high port

class template_Daemon_Bad_Start():

    def setUp(self):
        time_hacker.set_real_time()

    def get_login_and_group(self, p):
        try:
{'fraction_non_alphanumeric': 0.0815020268828675, 'fraction_numerical': 0.008534243652656284, 'mean_word_length': 3.664676616915423, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6923178', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1520, 'n_words': 516}