Ejemplo n.º 1
0
 def testBadCreate(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "foo"), monitors.EventType.Create)))
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "foo"), monitors.EventType.Create)))
     self.driver.run()
     self.assertErrors()
Ejemplo n.º 2
0
 def testSimpleDeleteWithModify(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "foo"), monitors.EventType.Create)))
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "foo"), monitors.EventType.Modify)))
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "foo"), monitors.EventType.Delete)))
     self.driver.run()
Ejemplo n.º 3
0
 def testDirectoryMethodsDirInfo(self):
     self.driver.add(DirInfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "dir"), monitors.EventType.Create)))
     self.driver.add(DirInfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "dir"), monitors.EventType.Modify)))
     self.driver.add(DirInfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "dir"), monitors.EventType.Delete)))
     self.driver.run()
Ejemplo n.º 4
0
 def testDirectoryMethodsInfo(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         self.dir / "foo", monitors.EventType.Create)))
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         self.dir / "foo", monitors.EventType.Modify)))
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         self.dir / "foo", monitors.EventType.Delete)))
     self.driver.run()
Ejemplo n.º 5
0
 def testDirectoryInDirectory(self):
     self.driver.add(
         DirInfoEvent(
             1,
             monitors.EventInfo(self.dir / "root" / "dir",
                                monitors.EventType.Create)))
     self.driver.add(
         DirInfoEvent(
             1,
             monitors.EventInfo(self.dir / "root" / "dir" / "dir",
                                monitors.EventType.Create)))
     self.driver.run()
Ejemplo n.º 6
0
 def testSimpleDelete(self):
     self.beforeMethod()
     self.driver.add(
         InfoEvent(
             1,
             monitors.EventInfo(self.dir / "foo",
                                monitors.EventType.Create)))
     self.driver.add(
         InfoEvent(
             1,
             monitors.EventInfo(self.dir / "foo",
                                monitors.EventType.Delete)))
     self.driver.run()
Ejemplo n.º 7
0
 def testBadCreate(self):
     self.beforeMethod()
     self.driver.add(
         InfoEvent(
             1,
             monitors.EventInfo(self.dir / "foo",
                                monitors.EventType.Create)))
     self.driver.add(
         InfoEvent(
             1,
             monitors.EventInfo(self.dir / "foo",
                                monitors.EventType.Create)))
     self.driver.run()
     self.assertErrors()
    def callback(self, monitorId, fileList):
        """
            Callback required by FSEvents.FSEventStream.

            :Parameters:


            :return: No explicit return value.

        """

        eventList = []
        for fileEvent in fileList:
            info = monitors.EventInfo(fileEvent[0], fileEvent[1])
            eventList.append(info)

        proxy = self.proxies[monitorId]

        try:
            self.log.info('Event notification on monitor id= %s', monitorId)
            self.log.debug(' ...notifications are: %s', str(eventList))
            proxy.fsEventHappened(monitorId, eventList)
        except Exception, e:
            self.log.info('Callback to monitor id=' + monitorId +
                          ' failed. Reason: ' + str(e))
Ejemplo n.º 9
0
 def testWithSingleImport(self):
     f = self.dir / "root" / "file"
     self.client.files = {str(f): [str(f)]}
     self.driver.add(DirInfoEvent(0, monitors.EventInfo(
         self.dir / "root" / "file", monitors.EventType.Create)))
     self.driver.run()
     time.sleep(0.25)
Ejemplo n.º 10
0
 def testBasicAdd(self):
     self.driver.add(
         DirInfoEvent(
             1,
             monitors.EventInfo(self.dir / "root" / "dirtimeout",
                                monitors.EventType.Create)))
     self.driver.run()
Ejemplo n.º 11
0
 def testWithMultiImport(self):
     f1 = str(self.dir / "root" / "file1")
     f2 = str(self.dir / "root" / "file2")
     f3 = str(self.dir / "root" / "file3")
     f4 = str(self.dir / "root" / "file4")
     self.client.files = {f1: [f1, f2, f3, f4]}
     self.client.setDirImportWait(1)
     self.driver.add(DirInfoEvent(0.0, monitors.EventInfo(
         f1, monitors.EventType.Create)))
     self.driver.add(DirInfoEvent(100, monitors.EventInfo(
         f2, monitors.EventType.Create)))
     self.driver.add(DirInfoEvent(200, monitors.EventInfo(
         f3, monitors.EventType.Create)))
     self.driver.add(DirInfoEvent(300, monitors.EventInfo(
         f4, monitors.EventType.Create)))
     time.sleep(1)
     self.driver.run()
Ejemplo n.º 12
0
 def testDirectoryDoesntExistOnDelete(self):
     self.beforeMethod()
     self.driver.add(
         DirInfoEvent(
             1,
             monitors.EventInfo(self.dir / "dir",
                                monitors.EventType.Delete)))
     self.driver.run()
     self.assertErrors()
Ejemplo n.º 13
0
 def testDirectoryMethods(self):
     self.beforeMethod()
     self.driver.add(
         DirInfoEvent(
             1,
             monitors.EventInfo(self.dir / "dir",
                                monitors.EventType.Create)))
     self.driver.add(
         DirInfoEvent(
             1,
             monitors.EventInfo(self.dir / "dir",
                                monitors.EventType.Modify)))
     self.driver.add(
         DirInfoEvent(
             1,
             monitors.EventInfo(self.dir / "dir",
                                monitors.EventType.Delete)))
     self.driver.run()
Ejemplo n.º 14
0
 def testDirectoryDoesntExistOnDelete(self):
     self.driver.add(DirInfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "dir"), monitors.EventType.Delete)))
     self.driver.run()
     self.assertErrors()
Ejemplo n.º 15
0
 def testBadFileId(self):
     # Could cause infinite loop
     with pytest.raises(omero.ApiUsageException):
         MockMonitor().fsEventHappened('', [monitors.EventInfo()])
Ejemplo n.º 16
0
 def testBadFileId(self):
     # Could cause infinite loop
     self.assertRaises(omero.ApiUsageException,
                       MockMonitor().fsEventHappened, '',
                       [monitors.EventInfo()])
Ejemplo n.º 17
0
 def testSimpleModify(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         self.dir / "foo", monitors.EventType.Create)))
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         self.dir / "foo", monitors.EventType.Modify)))
     self.driver.run()
Ejemplo n.º 18
0
 def testInfo(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo()))
     self.driver.run()
     self.assertEventCount(1)
Ejemplo n.º 19
0
 def testBadDelete(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         self.dir / "foo", monitors.EventType.Delete)))
     self.driver.run()
     self.assertErrors()
Ejemplo n.º 20
0
 def testSimpleCreate(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         old_div(self.dir, "foo"), monitors.EventType.Create)))
     self.driver.run()
Ejemplo n.º 21
0
 def testBad(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         "foo", monitors.EventType.Create)))
     self.driver.run()
     self.assertErrors()
Ejemplo n.º 22
0
 def testDirectoryDoesntExistOnModify(self):
     self.driver.add(DirInfoEvent(1, monitors.EventInfo(
         self.dir / "dir", monitors.EventType.Modify)))
     self.driver.run()
     self.assertErrors()
Ejemplo n.º 23
0
 def testBadModify(self):
     self.driver.add(InfoEvent(1, monitors.EventInfo(
         self.dir / "foo", monitors.EventType.Modify)))
     self.driver.run()
     self.assertErrors()