Example #1
0
 def testRedirectToQueue(self):
     qout = Queue()
     qerr = Queue()
     self.gateway = JavaGateway.launch_gateway(
         redirect_stdout=qout, redirect_stderr=qerr)
     for i in range(10):
         self.gateway.jvm.System.out.println("Test")
         self.gateway.jvm.System.err.println("Test2")
     sleep()
     for i in range(10):
         self.assertEqual("Test\n", qout.get())
         self.assertEqual("Test2\n", qerr.get())
     self.assertTrue(qout.empty)
     self.assertTrue(qerr.empty)
Example #2
0
 def testRedirectToQueue(self):
     qout = Queue()
     qerr = Queue()
     self.gateway = JavaGateway.launch_gateway(redirect_stdout=qout,
                                               redirect_stderr=qerr)
     for i in range(10):
         self.gateway.jvm.System.out.println("Test")
         self.gateway.jvm.System.err.println("Test2")
     sleep()
     for i in range(10):
         self.assertEqual("Test\n", qout.get())
         self.assertEqual("Test2\n", qerr.get())
     self.assertTrue(qout.empty)
     self.assertTrue(qerr.empty)
Example #3
0
 def testRedirectToQueue(self):
     end = os.linesep
     qout = Queue()
     qerr = Queue()
     self.gateway = JavaGateway.launch_gateway(
         redirect_stdout=qout, redirect_stderr=qerr)
     for i in range(10):
         self.gateway.jvm.System.out.println("Test")
         self.gateway.jvm.System.err.println("Test2")
     sleep()
     for i in range(10):
         self.assertEqual("Test{0}".format(end), qout.get())
         # Assert IN because some Java/OS outputs some garbage on stderr.
         line = qerr.get()
         if stderr_is_polluted(line):
             line = qerr.get()
         self.assertIn("Test2{0}".format(end), line)
     self.assertTrue(qout.empty)
     self.assertTrue(qerr.empty)
 def testRedirectToQueue(self):
     end = os.linesep
     qout = Queue()
     qerr = Queue()
     self.gateway = JavaGateway.launch_gateway(redirect_stdout=qout,
                                               redirect_stderr=qerr)
     for i in range(10):
         self.gateway.jvm.System.out.println("Test")
         self.gateway.jvm.System.err.println("Test2")
     sleep()
     for i in range(10):
         self.assertEqual("Test{0}".format(end), qout.get())
         # Assert IN because some Java/OS outputs some garbage on stderr.
         line = qerr.get()
         if stderr_is_polluted(line):
             line = qerr.get()
         self.assertIn("Test2{0}".format(end), line)
     self.assertTrue(qout.empty)
     self.assertTrue(qerr.empty)