Ejemplo n.º 1
0
    def testsubscribe(self):
        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(host,
                       port,
                       username,
                       password,
                       '1.0',
                       stdin=teststdin,
                       stdout=teststdout)

        time.sleep(3)

        teststdout.expect(
            'Subscribing to "/queue/testsubscribe" with acknowledge set to "auto", id set to "1"'
        )
        cli.onecmd('subscribe /queue/testsubscribe')
        teststdout.expect('MESSAGE')
        teststdout.expect('this is a test')
        cli.onecmd('send /queue/testsubscribe this is a test')

        time.sleep(3)

        teststdout.expect('Unsubscribing from "/queue/testsubscribe"')
        cli.onecmd('unsubscribe /queue/testsubscribe')
        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 2
0
    def test_ssl(self):
        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(sslhost,
                       sslport,
                       username,
                       password,
                       "1.0",
                       use_ssl=True,
                       stdin=teststdin,
                       stdout=teststdout)

        time.sleep(3)

        teststdout.expect(
            "Subscribing to '/queue/testsubscribe' with acknowledge set to 'auto', id set to '1'"
        )
        cli.onecmd("subscribe /queue/testsubscribe")
        teststdout.expect("MESSAGE")
        teststdout.expect("this is a test")
        cli.onecmd("send /queue/testsubscribe this is a test")

        time.sleep(3)

        teststdout.expect("Unsubscribing from '/queue/testsubscribe'")
        cli.onecmd("unsubscribe /queue/testsubscribe")
        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 3
0
    def test_on_disconnected_edgecase(self):
        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(host, port, username, password, "1.0", stdin=teststdin, stdout=teststdout)

        teststdout.expect(".*lost connection.*")

        cli.on_disconnected()
Ejemplo n.º 4
0
    def testsendfile(self):
        f = create_test_file()

        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(host,
                       port,
                       username,
                       password,
                       '1.2',
                       stdin=teststdin,
                       stdout=teststdout)

        time.sleep(3)

        teststdout.expect(
            'Subscribing to "/queue/testsendfile" with acknowledge set to "auto", id set to "1"'
        )
        cli.onecmd('subscribe /queue/testsendfile')

        time.sleep(3)

        teststdout.expect('MESSAGE')
        cli.onecmd('sendfile /queue/testsendfile %s' % f.name)

        time.sleep(3)

        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 5
0
    def testsendfile(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        stdout.expect('CONNECTED')
        
        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        cli.onecmd('sendfile /queue/testsendfile stomp/test/test.txt')

        time.sleep(3)

        cli.onecmd('quit')
Ejemplo n.º 6
0
    def testrunarg(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        stdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        stdout.expect('Subscribing to "/queue/testfile" with acknowledge set to "auto", id set to "1"')
        stdout.expect('this is a test')
        stdout.expect('MESSAGE')
        stdout.expect('Unsubscribing from "/queue/testfile"')

        cli.do_run('stomp/test/test.txt')
Ejemplo n.º 7
0
    def testrun(self):
        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect('Subscribing to "/queue/testfile" with acknowledge set to "auto", id set to "1"')
        teststdout.expect('this is a test')
        teststdout.expect('MESSAGE')
        teststdout.expect('Unsubscribing from "/queue/testfile"')
        cli.onecmd('run stomp/test/test.txt')
        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 8
0
    def testsendrec(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        
        stdout.expect('CONNECTED')
        
        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        stdout.expect('RECEIPT')
        cli.onecmd('sendrec /queue/testsendrec this is a test')

        time.sleep(3)

        cli.onecmd('quit')
Ejemplo n.º 9
0
    def testrunarg(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        stdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        stdout.expect(
            'Subscribing to "/queue/testfile" with acknowledge set to "auto", id set to "1"'
        )
        stdout.expect('this is a test')
        stdout.expect('MESSAGE')
        stdout.expect('Unsubscribing from "/queue/testfile"')

        cli.do_run('stomp/test/test.txt')
    def testsendfile(self):
        f = create_test_file()

        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        cli.onecmd('sendfile /queue/testsendfile %s' % f.name)

        time.sleep(3)

        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 11
0
    def testrunarg(self):
        f = create_test_file()

        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(host,
                       port,
                       username,
                       password,
                       '1.0',
                       stdin=teststdin,
                       stdout=teststdout)

        time.sleep(3)

        teststdout.expect(
            'Subscribing to "/queue/testfile" with acknowledge set to "auto", id set to "1"'
        )
        teststdout.expect('this is a test')
        teststdout.expect('MESSAGE')
        teststdout.expect('Unsubscribing from "/queue/testfile"')

        cli.do_run(f.name)

        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 12
0
    def test_multicast(self):
        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(None, None, None, None, "multicast", stdin=teststdin, stdout=teststdout)

        teststdout.expect("Subscribing to '/queue/testmulticastclisubscribe' with acknowledge set to 'auto', id set to '1'")
        cli.onecmd("subscribe /queue/testmulticastclisubscribe")
        teststdout.expect("MESSAGE")
        teststdout.expect("this is a test")
        cli.onecmd("send /queue/testsubscribe this is a test")

        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 13
0
 def testsubscribe(self):
     stdin = TestStdin()
     stdout = TestStdout(self)
     stdout.expect('CONNECTED')
     
     cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)
     
     time.sleep(3)
     
     stdout.expect('Subscribing to "/queue/testsubscribe" with acknowledge set to "auto", id set to "1"')
     cli.onecmd('subscribe /queue/testsubscribe')
     stdout.expect('MESSAGE')
     stdout.expect('this is a test')
     cli.onecmd('send /queue/testsubscribe this is a test')
     
     time.sleep(3)
     
     stdout.expect('Unsubscribing from "/queue/testsubscribe"')
     cli.onecmd('unsubscribe /queue/testsubscribe')      
     cli.onecmd('quit')
    def testssl(self):
        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(sslhost, sslport, username, password, '1.0', use_ssl=True, stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect('Subscribing to "/queue/testsubscribe" with acknowledge set to "auto", id set to "1"')
        cli.onecmd('subscribe /queue/testsubscribe')
        teststdout.expect('MESSAGE')
        teststdout.expect('this is a test')
        cli.onecmd('send /queue/testsubscribe this is a test')

        time.sleep(3)

        teststdout.expect('Unsubscribing from "/queue/testsubscribe"')
        cli.onecmd('unsubscribe /queue/testsubscribe')
        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 15
0
    def testsendfile(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        stdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        cli.onecmd('sendfile /queue/testsendfile stomp/test/test.txt')

        time.sleep(3)

        cli.onecmd('quit')
Ejemplo n.º 16
0
    def test_multicast(self):
        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(None,
                       None,
                       None,
                       None,
                       'multicast',
                       stdin=teststdin,
                       stdout=teststdout)

        teststdout.expect(
            'Subscribing to "/queue/testmulticastclisubscribe" with acknowledge set to "auto", id set to "1"'
        )
        cli.onecmd('subscribe /queue/testmulticastclisubscribe')
        teststdout.expect('MESSAGE')
        teststdout.expect('this is a test')
        cli.onecmd('send /queue/testsubscribe this is a test')

        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 17
0
    def testsendrec(self):
        stdin = TestStdin()
        stdout = TestStdout(self)

        stdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        stdout.expect('RECEIPT')
        cli.onecmd('sendrec /queue/testsendrec this is a test')

        time.sleep(3)

        cli.onecmd('quit')
Ejemplo n.º 18
0
    def testsendfile(self):
        f = create_test_file()

        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(host, port, username, password, "1.2", stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect("Subscribing to '/queue/testsendfile' with acknowledge set to 'auto', id set to '1'")
        cli.onecmd("subscribe /queue/testsendfile")

        time.sleep(3)

        teststdout.expect("MESSAGE")
        cli.onecmd("sendfile /queue/testsendfile %s" % f.name)

        time.sleep(3)

        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 19
0
    def testsendfileheaders(self):
        f = create_test_file()

        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(host, port, username, password, "1.2", stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        cli.onecmd("sendfile /queue/testsendfile %s { \"custom\" : \"header\" }" % f.name)

        time.sleep(3)

        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 20
0
    def testsendrec(self):
        teststdin = StubStdin()
        teststdout = StubStdout(self)

        teststdout.expect("CONNECTED")

        cli = StompCLI(host, port, username, password, "1.1", stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect("RECEIPT")
        cli.onecmd("sendrec /queue/testsendrec this is a test")

        time.sleep(3)

        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 21
0
    def testrunarg(self):
        f = create_test_file()

        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(host, port, username, password, "1.0", stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect("Subscribing to '/queue/testfile' with acknowledge set to 'auto', id set to '1'")
        teststdout.expect("this is a test")
        teststdout.expect("MESSAGE")
        teststdout.expect("Unsubscribing from '/queue/testfile'")

        cli.do_run(f.name)

        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 22
0
    def testsendfile(self):
        f = create_test_file()

        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(host,
                       port,
                       username,
                       password,
                       '1.0',
                       stdin=teststdin,
                       stdout=teststdout)

        time.sleep(3)

        cli.onecmd('sendfile /queue/testsendfile %s' % f.name)

        time.sleep(3)

        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 23
0
    def testsendrec(self):
        teststdin = TestStdin()
        teststdout = TestStdout(self)

        teststdout.expect('CONNECTED')

        cli = StompCLI(host,
                       port,
                       username,
                       password,
                       '1.1',
                       stdin=teststdin,
                       stdout=teststdout)

        time.sleep(3)

        teststdout.expect('RECEIPT')
        cli.onecmd('sendrec /queue/testsendrec this is a test')

        time.sleep(3)

        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 24
0
 def test_invalid_version(self):
     with self.assertRaises(RuntimeError) as _:
         StompCLI(host, port, username, password, 'invalid')
Ejemplo n.º 25
0
    def teststats(self):
        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(host, port, username, password, "1.0", stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect("Subscribing to '/queue/teststats' with acknowledge set to 'auto', id set to '1'")
        cli.onecmd("subscribe /queue/teststats")

        teststdout.expect(".*No stats available.*")
        cli.onecmd("stats")

        time.sleep(1)

        cli.onecmd("stats on")
        cli.onecmd("send /queue/teststats this is a test")

        teststdout.expect("MESSAGE")
        teststdout.expect("this is a test")

        time.sleep(3)

        cli.onecmd("stats")

        teststdout.expect("Unsubscribing from '/queue/teststats'")
        cli.onecmd("unsubscribe /queue/teststats")
        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 26
0
    def teststats(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        stdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        stdout.expect(
            'Subscribing to "/queue/teststats" with acknowledge set to "auto", id set to "1"'
        )
        cli.onecmd('subscribe /queue/teststats')

        stdout.expect('.*No stats available.*')
        cli.onecmd('stats')

        time.sleep(1)

        cli.onecmd('stats on')
        cli.onecmd('send /queue/teststats this is a test')

        stdout.expect('MESSAGE')
        stdout.expect('this is a test')

        time.sleep(3)

        cli.onecmd('stats')

        stdout.expect('Unsubscribing from "/queue/teststats"')
        cli.onecmd('unsubscribe /queue/teststats')
        cli.onecmd('quit')
Ejemplo n.º 27
0
    def test_help(self):
        teststdin = TestStdin()

        cli = StompCLI(host, port, username, password, '1.0', stdin=teststdin)

        cli.help_help()
        cli.help_quit()
        cli.help_exit()
        cli.help_EOF()
        cli.help_subscribe()
        cli.help_unsubscribe()
        cli.help_send()
        cli.help_sendrec()
        cli.help_sendreply()
        cli.help_sendfile()
        cli.help_version()
        cli.help_ack()
        cli.help_nack()
        cli.help_abort()
        cli.help_commit()
        cli.help_stats()
        cli.help_run()
        cli.help_begin()
Ejemplo n.º 28
0
    def testabort(self):
        teststdin = StubStdin()
        teststdout = StubStdout(self)
        teststdout.expect("CONNECTED")

        cli = StompCLI(host, port, username, password, "1.2", stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect("Subscribing to '/queue/testabort' with acknowledge set to 'auto', id set to '1'")
        cli.onecmd("subscribe /queue/testabort")

        cli.onecmd("begin")
        cli.onecmd("send /queue/testabort this is a test")
        cli.onecmd("abort")

        time.sleep(3)

        teststdout.expect("Unsubscribing from '/queue/testabort'")
        cli.onecmd("unsubscribe /queue/testabort")
        teststdout.expect("Shutting down, please wait")
        cli.onecmd("quit")
Ejemplo n.º 29
0
 def test_invalid_version(self):
     with pytest.raises(RuntimeError):
         StompCLI(host, port, username, password, "invalid")
Ejemplo n.º 30
0
    def teststats(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        stdout.expect('CONNECTED')
        
        cli = StompCLI(host, port, username, password, 1.0, stdin, stdout)

        time.sleep(3)

        stdout.expect('Subscribing to "/queue/teststats" with acknowledge set to "auto", id set to "1"')
        cli.onecmd('subscribe /queue/teststats')
        
        stdout.expect('.*No stats available.*')
        cli.onecmd('stats')
        
        time.sleep(1)
        
        cli.onecmd('stats on')
        cli.onecmd('send /queue/teststats this is a test')

        stdout.expect('MESSAGE')
        stdout.expect('this is a test')

        time.sleep(3)
        
        cli.onecmd('stats')

        stdout.expect('Unsubscribing from "/queue/teststats"')
        cli.onecmd('unsubscribe /queue/teststats')
        cli.onecmd('quit')
    def testabort(self):
        teststdin = TestStdin()
        teststdout = TestStdout(self)
        teststdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin=teststdin, stdout=teststdout)

        time.sleep(3)

        teststdout.expect('Subscribing to "/queue/testabort" with acknowledge set to "auto", id set to "1"')
        cli.onecmd('subscribe /queue/testabort')

        cli.onecmd('begin')
        cli.onecmd('send /queue/testabort this is a test')
        cli.onecmd('abort')

        time.sleep(3)

        teststdout.expect('Unsubscribing from "/queue/testabort"')
        cli.onecmd('unsubscribe /queue/testabort')
        teststdout.expect('Shutting down, please wait')
        cli.onecmd('quit')
Ejemplo n.º 32
0
    def testcommit(self):
        stdin = TestStdin()
        stdout = TestStdout(self)
        stdout.expect('CONNECTED')

        cli = StompCLI(host, port, username, password, '1.0', stdin, stdout)

        time.sleep(3)

        stdout.expect(
            'Subscribing to "/queue/testcommit" with acknowledge set to "auto", id set to "1"'
        )
        cli.onecmd('subscribe /queue/testcommit')

        cli.onecmd('begin')
        cli.onecmd('send /queue/testcommit this is a test')

        stdout.expect('Committing.*')
        stdout.expect('MESSAGE')
        stdout.expect('this is a test')
        cli.onecmd('commit')

        time.sleep(3)

        stdout.expect('Unsubscribing from "/queue/testcommit"')
        cli.onecmd('unsubscribe /queue/testcommit')
        cli.onecmd('quit')