Beispiel #1
0
 def __init__(self, port):
     self.ledger_manager = DummyCore.DB()
     self.storage_manager = DummyCore.Storage()
     self.stats = bbc_stats.BBcStats()
     th = threading.Thread(target=start_dummy_server, args=(port, ))
     th.setDaemon(True)
     th.start()
Beispiel #2
0
    def __init__(self, core_port=None, workingdir=".bbc1", configfile=None, ipv6=False,
                 server_start=True, default_conffile=None, logconf=None):
        if logconf is not None:
            initialize_logger(logconf)
        self.logger = logging.getLogger("bbc_core")
        self.stats = bbc_stats.BBcStats()
        self.config = BBcConfig(workingdir, configfile, default_conffile)
        conf = self.config.get_config()
        self.ipv6 = ipv6
        self.logger.debug("config = %s" % conf)
        self.networking = bbc_network.BBcNetwork(self.config, core=self)
        for domain_id_str in conf['domains'].keys():
            domain_id = bbclib.convert_idstring_to_bytes(domain_id_str)
            c = self.config.get_domain_config(domain_id)
            self.networking.create_domain(domain_id=domain_id, config=c)

        gevent.signal(signal.SIGINT, self.quit_program)
        if server_start:
            self._start_server(core_port)
Beispiel #3
0
    def __init__(self,
                 core_port=None,
                 workingdir=".bbc1",
                 configfile=None,
                 ipv6=False,
                 server_start=True):
        self.logger = get_fluent_logger(name="bbc_core")
        self.stats = bbc_stats.BBcStats()
        self.config = BBcConfig(workingdir, configfile)
        conf = self.config.get_config()
        self.ipv6 = ipv6
        self.logger.debug("config = %s" % conf)
        self.test_tx_obj = BBcTransaction()
        self.networking = bbc_network.BBcNetwork(self.config, core=self)
        for domain_id_str in conf['domains'].keys():
            domain_id = bbclib.convert_idstring_to_bytes(domain_id_str)
            c = self.config.get_domain_config(domain_id)
            self.networking.create_domain(domain_id=domain_id, config=c)

        gevent.signal(signal.SIGINT, self.quit_program)
        if server_start:
            self._start_server(core_port)
 def __init__(self):
     self.networking = DummyCore.BBcNetwork(self)
     self.stats = bbc_stats.BBcStats()
Beispiel #5
0
 def __init__(self):
     self.user_message_routing = DummyCore.UserMessageRouting()
     self.stats = bbc_stats.BBcStats()
     self.logger = logging.getLogger("test")
Beispiel #6
0
# -*- coding: utf-8 -*-
import pytest
import pprint

import sys
sys.path.extend(["../"])
from bbc_simple.core import bbc_stats

bbcstats = bbc_stats.BBcStats()


class TestBBcStats(object):
    def test_0_get(self):
        print("-----", sys._getframe().f_code.co_name, "-----")
        result = bbcstats.get_stats()
        pprint.pprint(result)

    def test_1_add_item(self):
        print("-----", sys._getframe().f_code.co_name, "-----")
        bbcstats.update_stats("cat1", "item1", 10)
        bbcstats.update_stats("cat2", "itemA", 20)
        bbcstats.update_stats("cat1", "item2", 30)

    def test_2_increment(self):
        print("-----", sys._getframe().f_code.co_name, "-----")
        bbcstats.update_stats_increment("cat1", "item2", 5)

    def test_3_get(self):
        print("-----", sys._getframe().f_code.co_name, "-----")
        result = bbcstats.get_stats()
        pprint.pprint(result)
Beispiel #7
0
 def __init__(self):
     self.user_message_routing = DummyCore.UserMessageRouting()
     self.stats = bbc_stats.BBcStats()