def testAnalyse(self):
     t = ThroughputAnalyser(eventpath = self.testdir)
     t._analyseRepository = self.mockAnalyseRepository
     
     report = t.analyse(['repo1','repo2'], '2006-08-31')
     
     self.assertEquals(1000, report.records)
     self.assertEquals(2000.0, report.seconds)
     self.assertEquals(['repo1', 'repo2'], self.mockAnalyseRepository_arguments)
Example #2
0
    def testAnalyseNothing(self):
        t = ThroughputAnalyser(eventpath=self.testdir)
        t._analyseRepository = self.mockAnalyseRepository

        report = t.analyse([], '2006-08-31')

        self.assertEqual(0, report.records)
        self.assertEqual(0.0, report.seconds)
        self.assertEqual('-', report.recordsPerSecond())
        self.assertEqual('-', report.recordsPerDay())
Example #3
0
    def testAnalyse(self):
        t = ThroughputAnalyser(eventpath=self.testdir)
        t._analyseRepository = self.mockAnalyseRepository

        report = t.analyse(['repo1', 'repo2'], '2006-08-31')

        self.assertEqual(1000, report.records)
        self.assertEqual(2000.0, report.seconds)
        self.assertEqual(['repo1', 'repo2'],
                         self.mockAnalyseRepository_arguments)
 def testAnalyseNothing(self):
     t = ThroughputAnalyser(eventpath = self.testdir)
     t._analyseRepository = self.mockAnalyseRepository
     
     report = t.analyse([], '2006-08-31')
     
     self.assertEquals(0, report.records)
     self.assertEquals(0.0, report.seconds)
     self.assertEquals('-' , report.recordsPerSecond())
     self.assertEquals('-' , report.recordsPerDay())
Example #5
0
    def testAnalyseRepository(self):
        r = open(os.path.join(self.testdir, 'repo1.events'), 'w')
        try:
            r.write("""
[2006-08-30 00:00:15.500]	ENDHARVEST	[repo1]	
[2006-08-30 01:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-30 01:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1000, ResumptionToken: r1
[2006-08-30 01:00:15.500]	ENDHARVEST	[repo1]	
[2006-08-31 01:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-31 01:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1200, ResumptionToken: r1
[2006-08-31 01:00:15.500]	ENDHARVEST	[repo1]	
[2006-08-31 02:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-31 02:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1400, ResumptionToken: r2
[2006-08-31 02:00:25.500]	ENDHARVEST	[repo1]	
[2006-08-31 03:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-31 03:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1600, ResumptionToken: r3
[2006-08-31 03:00:35.500]	ENDHARVEST	[repo1]	
""")
        finally:
            r.close()
        t = ThroughputAnalyser(eventpath=self.testdir)
        records, seconds = t._analyseRepository('repo1', '2006-08-31')
        self.assertEqual(600, records)
        self.assertEqual(76.5, seconds)
    def testAnalyseRepository(self):
        r = open(os.path.join(self.testdir, 'repo1.events'), 'w')
        try:
            r.write("""
[2006-08-30 00:00:15.500]	ENDHARVEST	[repo1]	
[2006-08-30 01:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-30 01:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1000, ResumptionToken: r1
[2006-08-30 01:00:15.500]	ENDHARVEST	[repo1]	
[2006-08-31 01:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-31 01:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1200, ResumptionToken: r1
[2006-08-31 01:00:15.500]	ENDHARVEST	[repo1]	
[2006-08-31 02:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-31 02:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1400, ResumptionToken: r2
[2006-08-31 02:00:25.500]	ENDHARVEST	[repo1]	
[2006-08-31 03:00:00.000]	STARTHARVEST	[repo1]	Uploader connected ...
[2006-08-31 03:00:10.000]	SUCCES	[repo1]	Harvested/Uploaded/Deleted/Total: 200/200/0/1600, ResumptionToken: r3
[2006-08-31 03:00:35.500]	ENDHARVEST	[repo1]	
""")
        finally:
            r.close()
        t = ThroughputAnalyser(eventpath = self.testdir)
        records, seconds = t._analyseRepository('repo1', '2006-08-31')
        self.assertEquals(600, records)
        self.assertEquals(76.5, seconds)
Example #7
0
 def testReportOnEmptyEventsFile(self):
     t = ThroughputAnalyser(eventpath=self.testdir)
     records, seconds = t._analyseRepository('repo1', '2006-08-31')
     self.assertEqual(0, records)
     self.assertEqual(0, seconds)
Example #8
0
 def testAnalyseNonExistingRepository(self):
     t = ThroughputAnalyser(eventpath=self.testdir)
     records, seconds = t._analyseRepository('repository', '2006-08-31')
     self.assertEqual(0, records)
     self.assertEqual(0.0, seconds)
 def testReportOnEmptyEventsFile(self):
     t = ThroughputAnalyser(eventpath = self.testdir)
     records, seconds = t._analyseRepository('repo1', '2006-08-31')
     self.assertEquals(0, records)
     self.assertEquals(0, seconds)
 def testAnalyseNonExistingRepository(self):
     t = ThroughputAnalyser(eventpath = self.testdir)
     records, seconds = t._analyseRepository('repository', '2006-08-31')
     self.assertEquals(0, records)
     self.assertEquals(0.0, seconds)