示例#1
0
    def setUp(self):
        token = None
        handler = StitchHandler(target_stitch.DEFAULT_MAX_BATCH_BYTES, 2)
        self.og_check_send_exception = target_stitch.check_send_exception
        self.out = io.StringIO()
        self.target_stitch = target_stitch.TargetStitch([handler], self.out,
                                                        4000000, 1, 0)
        self.queue = []
        target_stitch.SEND_EXCEPTION = None
        for f, s in target_stitch.PENDING_REQUESTS:
            try:
                f.cancel()
            except:
                pass

        target_stitch.PENDING_REQUESTS = []
        LOGGER.info("cleaning SEND_EXCEPTIONS: %s AND PENDING_REQUESTS: %s",
                    target_stitch.SEND_EXCEPTION,
                    target_stitch.PENDING_REQUESTS)
        target_stitch.CONFIG = {
            'token': "some-token",
            'client_id': "some-client",
            'disable_collection': True,
            'connection_ns': "some-ns",
            'batch_size_preferences': {
                'full_table_streams': [],
                'batch_size_preference': None,
                'user_batch_size_preference': None,
            },
            'turbo_boost_factor': 10,
            'small_batch_url': "http://small-batch",
            'big_batch_url': "http://big-batch",
        }
 def setUp(self):
     self.handler = DummyHandler()
     self.state_writer = io.StringIO()
     self.target_stitch = target_stitch.TargetStitch(
         handlers=[self.handler],
         state_writer=self.state_writer,
         batch_delay_seconds=30)
    def setUp(self):
        token = None
        self.first_flush_error = None
        self.second_flush_error = None

        handler = StitchHandler(target_stitch.DEFAULT_MAX_BATCH_BYTES, 2)

        self.out = io.StringIO()
        self.target_stitch = target_stitch.TargetStitch(
            [handler], self.out, 4000000, 2, 100000)
        self.queue = [simplejson.dumps({"type": "SCHEMA", "stream": "chicken_stream",
                                  "key_properties": ["my_float"],
                                  "schema": {"type": "object",
                                             "properties": {"my_float": {"type": "number"}}}})]
        target_stitch.SEND_EXCEPTION = None
        target_stitch.PENDING_REQUESTS = []
        self.og_flush_states = StitchHandler.flush_states
        self.flushed_state_count = 0
        StitchHandler.flush_states = self.fake_flush_states

        target_stitch.CONFIG = {
            'token': "some-token",
            'client_id': "some-client",
            'disable_collection': True,
            'connection_ns': "some-ns",
            'batch_size_preferences' : {
                'full_table_streams' : [],
                'batch_size_preference': None,
                'user_batch_size_preference': None,
            },
            'turbo_boost_factor' : 10,
            'small_batch_url' : "http://small-batch",
            'big_batch_url' : "http://big-batch",
        }
示例#4
0
    def setUp(self):
        token = None
        handler = StitchHandler(target_stitch.DEFAULT_MAX_BATCH_BYTES, 2)

        self.og_check_send_exception = target_stitch.check_send_exception
        self.out = io.StringIO()
        self.target_stitch = target_stitch.TargetStitch([handler], self.out,
                                                        4000000, 2, 100000)
        self.queue = [
            json.dumps({
                "type": "SCHEMA",
                "stream": "chicken_stream",
                "key_properties": ["id"],
                "schema": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        }
                    }
                }
            })
        ]

        target_stitch.SEND_EXCEPTION = None
        for f, s in target_stitch.PENDING_REQUESTS:
            try:
                f.cancel()
            except:
                pass

        target_stitch.PENDING_REQUESTS = []
        LOGGER.info("cleaning SEND_EXCEPTIONS: %s AND PENDING_REQUESTS: %s",
                    target_stitch.SEND_EXCEPTION,
                    target_stitch.PENDING_REQUESTS)

        target_stitch.CONFIG = {
            'token': "some-token",
            'client_id': "some-client",
            'disable_collection': True,
            'connection_ns': "some-ns",
            'batch_size_preferences': {
                'full_table_streams': [],
                'batch_size_preference': None,
                'user_batch_size_preference': None,
            },
            'turbo_boost_factor': 10,
            'small_batch_url': "http://small-batch",
            'big_batch_url': "http://big-batch",
        }
 def setUp(self):
     self.client = DummyClient()
     self.out = io.StringIO()
     self.target_stitch = target_stitch.TargetStitch([self.client],
                                                     self.out, 4000000,
                                                     20000, 100000)
示例#6
0
 def setUp(self):
     token = None
     handler = StitchHandler(token, DEFAULT_STITCH_URL, 4000000)
     out = io.StringIO()
     self.target_stitch = target_stitch.TargetStitch(
         [handler], out, 4000000, 20000, 100000)