Example #1
0
 def afterSetUp(self):
   """Instantiate one OpenOffice"""
   self.openoffice = OpenOffice()
   self.openoffice.loadSettings("localhost", 4090,
                               self.working_path,
                               self.office_binary_path,
                               self.uno_path,
                               'en',
                               self.environment_dict)
   self.openoffice.start()
Example #2
0
 def afterSetUp(self):
   """Instantiate one OpenOffice"""
   self.openoffice = OpenOffice()
   self.openoffice.loadSettings("localhost", 4090,
                               self.working_path,
                               self.office_binary_path,
                               self.uno_path,
                               'en')
   self.openoffice.start()
Example #3
0
  def testStartTwoOpenOfficeWithTheSameAddress(self):
    """Check if starting two openoffice using the same address, the second
    openoffice will terminate the first"""
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4090,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertEquals(self.openoffice.status(), False)
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()

    self.openoffice.start()
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4091,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertTrue(self.openoffice.status())
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()
    self.assertFalse(second_openoffice.status())
Example #4
0
class TestOpenOffice(HandlerTestCase):
  """Test OpenOffice object and manipulation of OOo Instance"""

  def afterSetUp(self):
    """Instantiate one OpenOffice"""
    self.openoffice = OpenOffice()
    self.openoffice.loadSettings("localhost", 4090,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    self.openoffice.start()

  def tearDown(self):
    """Stop the OpenOffice"""
    if self.openoffice.status():
      self.openoffice.stop()

  def testPid(self):
    """Test pid function to validate if the return is correctly"""
    self.assertNotEquals(self.openoffice.pid(), None)
    self.openoffice.stop()
    self.assertEquals(self.openoffice.pid(), None)
    self.assertEquals(self.openoffice.status(), False)

  def testOpenOfficeStart(self):
    """Test if the start method works correclty"""
    self.assertTrue(self.openoffice.status())

  def testOpenOfficeStop(self):
    """Test if the stop method works correctly"""
    self.openoffice.stop()
    waitStopDaemon(self.openoffice)
    self.assertEquals(self.openoffice.status(), False)

  def testOpenOfficeRequest(self):
    """Test if the requisition amount is increasing right"""
    self.openoffice.acquire()
    self.assertEquals(self.openoffice.request, 1)
    self.openoffice.release()

  def testOpenOfficeRestart(self):
    """Test if the method restart works correctly"""
    self.openoffice.restart()
    self.assertTrue(self.openoffice.status())

  def testOpenOfficeLock(self):
    """Test lock and unlock"""
    self.openoffice.acquire()
    self.assertTrue(self.openoffice.isLocked())
    self.openoffice.release()
    self.assertEquals(self.openoffice.isLocked(), False)

  def testStartTwoOpenOfficeWithTheSameAddress(self):
    """Check if starting two openoffice using the same address, the second
    openoffice will terminate the first"""
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4090,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertEquals(self.openoffice.status(), False)
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()

    self.openoffice.start()
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4091,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertTrue(self.openoffice.status())
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()
    self.assertFalse(second_openoffice.status())
Example #5
0
  def testStartTwoOpenOfficeWithTheSameAddress(self):
    """Check if starting two openoffice using the same address, the second
    openoffice will terminate the first"""
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4090,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertEquals(self.openoffice.status(), False)
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()

    self.openoffice.start()
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4091,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertTrue(self.openoffice.status())
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()
    self.assertFalse(second_openoffice.status())
Example #6
0
class TestOpenOffice(HandlerTestCase):
  """Test OpenOffice object and manipulation of OOo Instance"""

  def afterSetUp(self):
    """Instantiate one OpenOffice"""
    self.openoffice = OpenOffice()
    self.openoffice.loadSettings("localhost", 4090,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    self.openoffice.start()

  def tearDown(self):
    """Stop the OpenOffice"""
    if self.openoffice.status():
      self.openoffice.stop()

  def testPid(self):
    """Test pid function to validate if the return is correctly"""
    self.assertNotEquals(self.openoffice.pid(), None)
    self.openoffice.stop()
    self.assertEquals(self.openoffice.pid(), None)
    self.assertEquals(self.openoffice.status(), False)

  def testOpenOfficeStart(self):
    """Test if the start method works correclty"""
    self.assertTrue(self.openoffice.status())

  def testOpenOfficeStop(self):
    """Test if the stop method works correctly"""
    self.openoffice.stop()
    waitStopDaemon(self.openoffice)
    self.assertEquals(self.openoffice.status(), False)

  def testOpenOfficeRequest(self):
    """Test if the requisition amount is increasing right"""
    self.openoffice.acquire()
    self.assertEquals(self.openoffice.request, 1)
    self.openoffice.release()

  def testOpenOfficeRestart(self):
    """Test if the method restart works correctly"""
    self.openoffice.restart()
    self.assertTrue(self.openoffice.status())

  def testOpenOfficeLock(self):
    """Test lock and unlock"""
    self.openoffice.acquire()
    self.assertTrue(self.openoffice.isLocked())
    self.openoffice.release()
    self.assertEquals(self.openoffice.isLocked(), False)

  def testStartTwoOpenOfficeWithTheSameAddress(self):
    """Check if starting two openoffice using the same address, the second
    openoffice will terminate the first"""
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4090,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertEquals(self.openoffice.status(), False)
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()

    self.openoffice.start()
    second_openoffice = OpenOffice()
    second_openoffice.loadSettings("localhost", 4091,
                                self.working_path,
                                self.office_binary_path,
                                self.uno_path,
                                'en',
                                self.environment_dict)
    second_openoffice.start()
    self.assertTrue(self.openoffice.status())
    self.assertTrue(second_openoffice.status())
    second_openoffice.stop()
    self.assertFalse(second_openoffice.status())