예제 #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()
예제 #2
0
 def __init__(self, domain_id_str=None, config=None, workingdir=None):
     self.logger = logger.get_logger("dummy")
     self.config = config
     self.working_dir = workingdir
     self.storage_root = os.path.join(self.working_dir, domain_id_str)
     if not os.path.exists(self.storage_root):
         os.makedirs(self.storage_root, exist_ok=True)
     self.stats = bbc_stats.BBcStats()  # dummy
     self.upgraded_from = data_handler.DB_VERSION
     self.db_adaptors = list()
     self.dbs = list()
     self._db_setup()
예제 #3
0
 def __init__(self):
     self.networking = DummyCore.BBcNetwork(self)
     self.stats = bbc_stats.BBcStats()
예제 #4
0
 def __init__(self):
     self.user_message_routing = DummyCore.UserMessageRouting()
     self.stats = bbc_stats.BBcStats()
예제 #5
0
# -*- coding: utf-8 -*-
import pytest
import pprint

import sys
sys.path.extend(["../"])
from bbc1.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)