<commit_before>try:
    from queue import Queue, Empty, Full
except ImportError:
    from Queue import Queue, Empty, Full
import threading
import sys
import time
import unittest

import stomp

import testlistener

class MQ(object):
    def __init__(self):
        self.connection = stomp.Connection([('localhost', 61613)])
        self.connection.set_listener('', None)
        self.connection.start()
        self.connection.connect(wait=True)

    def send(self, topic, msg, persistent='true', retry=False):
        self.connection.send(destination="/topic/%s" % topic, message=msg,
                             persistent=persistent)
mq = MQ()


class TestThreading(unittest.TestCase):

    def setUp(self):
        """Test that mq sends don't wedge their threads.

        Starts a number of sender threads, and runs for a set amount of
        time. Each thread sends messages as fast as it can, and after each
        send, pops from a Queue. Meanwhile, the Queue is filled with one
        marker per second. If the Queue fills, the test fails, as that
        indicates that all threads are no longer emptying the queue, and thus
        must be wedged in their send() calls.

        """
        self.Q = Queue(10)
        self.Cmd = Queue()
        self.Error = Queue()
        self.clients = 20<commit_msg>update test to run against apollo<commit_after>try:
    from queue import Queue, Empty, Full
except ImportError:
    from Queue import Queue, Empty, Full
import threading
import sys
import time
import unittest

import stomp

import testlistener

class MQ(object):
    def __init__(self):
        self.connection = stomp.Connection([('localhost', 61613)], 'admin', 'password')
        self.connection.set_listener('', None)
        self.connection.start()
        self.connection.connect(wait=True)

    def send(self, topic, msg, persistent='true', retry=False):
        self.connection.send(destination="/topic/%s" % topic, message=msg,
                             persistent=persistent)
mq = MQ()


class TestThreading(unittest.TestCase):

    def setUp(self):
        """Test that mq sends don't wedge their threads.

        Starts a number of sender threads, and runs for a set amount of
        time. Each thread sends messages as fast as it can, and after each
        send, pops from a Queue. Meanwhile, the Queue is filled with one
        marker per second. If the Queue fills, the test fails, as that
        indicates that all threads are no longer emptying the queue, and thus
        must be wedged in their send() calls.

        """
        self.Q = Queue(10)
        self.Cmd = Queue()
        self.Error = Queue()
        self.clients = 20
{'fraction_non_alphanumeric': 0.08747663551401869, 'fraction_numerical': 0.0067289719626168224, 'mean_word_length': 2.6557377049180326, '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': '896552', 'n_tokens_mistral': 760, 'n_tokens_neox': 725, 'n_words': 284}