Exemple #1
0
def test_take2_Fail(m_class):

    xBody = "ABC"

    msg = mjcIMsg.mjcMessage1(xBody)

    assert True == m_class.put(msg)

    x = m_class.take()
    x = m_class.take()

    assert None == x
def test_take2_Fail(m_class):

    xBody       =   "ABC"

    msg         =   mjcIMsg.mjcMessage1(xBody)

    assert True ==  m_class.put(msg)

    x = m_class.take()
    x = m_class.take()

    assert None == x
def test_create_created(m_class):

    global host, port

    assert m_class != None

    msg     = mjcIMsg.mjcMessage1("ABC")

    m_class.send(msg)

    msg         = mjcIMsg.done()

    m_class.send(msg)
Exemple #4
0
def test_take1_OK(m_class):

    xBody = "ABC"

    msg = mjcIMsg.mjcMessage1(xBody)

    assert True == m_class.put(msg)

    x = m_class.take()

    assert isinstance(x, mjcIMsg.mjcMessage1)

    assert xBody == x.body
def test_take1_OK(m_class):

    xBody       =   "ABC"

    msg         =   mjcIMsg.mjcMessage1(xBody)

    assert True ==  m_class.put(msg)

    x = m_class.take()

    assert isinstance(x, mjcIMsg.mjcMessage1)

    assert xBody == x.body
def test_create_created(m_class):

    global host, port

    assert m_class != None

    msg = mjcIMsg.mjcMessage1("ABC")

    m_class.send(msg)

    msg = mjcIMsg.done()

    m_class.send(msg)
def test_done_stops_process(m_class):

    from time import sleep

    x       = mjcIMsg.mjcMessage1("ABC")

    m_class.send(x)

    x       = mjcIMsg.done()

    m_class.send(x)

    sleep(1)

    a       = m_class.isAlive();

    m_class.shutdown()

    assert a == False
Exemple #8
0
def test_done_stops_process(m_class):

    from time import sleep

    x = mjcIMsg.mjcMessage1("ABC")

    m_class.send(x)

    x = mjcIMsg.done()

    m_class.send(x)

    sleep(1)

    a = m_class.isAlive()

    m_class.shutdown()

    assert a == False
def test_run_msg1_leavesQueueEmpty(m_class):

    xBody       = "ABC"

    msg         = mjcIMsg.mjcMessage1(xBody)

    y           = m_class.send(msg)

    msg         = mjcIMsg.done()

    y           = m_class.send(msg)

    m_class.shutdown()

    z           = m_class.qIn()
    a1          = z.take()

    if (a1):
        a1 = a1.body

    assert a1  == None
Exemple #10
0
def test_run_msg1_leavesQueueEmpty(m_class):

    xBody = "ABC"

    msg = mjcIMsg.mjcMessage1(xBody)

    y = m_class.send(msg)

    msg = mjcIMsg.done()

    y = m_class.send(msg)

    m_class.shutdown()

    z = m_class.qIn()
    a1 = z.take()

    if (a1):
        a1 = a1.body

    assert a1 == None
Exemple #11
0
def test_create_created(m_class):

    global host, port

    assert m_class != None

    client = mjcMsgSocket.createSender(host, port)

    msg = mjcIMsg.mjcMessage1("ABC")
    client.put(msg)
    ack = client.take()
    if ack and ack.body:
        print("client got ack.body={}".format(ack.body))

    m_class.shutdown()

    m_class = None

    client.shutdown()

    client = None
def test_create_created(m_class):

    global host, port

    assert m_class != None

    client      = mjcMsgSocket.createSender(host, port)

    msg         = mjcIMsg.mjcMessage1("ABC")
    client.put(msg)
    ack         = client.take()
    if ack and ack.body:
        print("client got ack.body={}".format(ack.body))

    m_class.shutdown()

    m_class = None

    client.shutdown()

    client = None
Exemple #13
0
def _test_create_created(m_class):

    global host, port

    # (host, port) = ("127.0.0.1", 62029)
    # qIn         = mjcMsgQ.mjcMsgQ()
    # qOut        = mjcMsgQ.mjcMsgQ()

    # server      = mjcSockListen1.create(qIn, qOut, host, port)

    assert m_class != None

    msg     = mjcIMsg.mjcMessage1("ABC")

    m_class.send(msg)

    msg         = mjcIMsg.done()

    m_class.send(msg)

    m_class.shutdown()