Example #1
0
    def testConversion(self):
        datadir = join(self.tempdir, 'oai_conversion_v8_to_v9')
        copytree(join(mypath, 'data', 'oai_conversion_v8_to_v9'), datadir)
        system("%s %s --i-know-what-i-am-doing > %s 2>&1" % (
                join(binDir, 'convert_oai_v8_to_v9'),
                datadir,
                join(self.tempdir, 'oai_conversion_v8_to_v9.log'),
            ))
        log = open(join(self.tempdir, 'oai_conversion_v8_to_v9.log')).read()
        self.assertEquals('9', open(join(datadir, 'oai.version')).read(), log)
        jazz = OaiJazz(datadir)
        result = jazz.oaiSelect(prefix='oai_dc', shouldCountHits=True, partition=Partition.create("1/2"))
        records = list(result.records)
        self.assertEquals(['oai:1', 'oai:5', 'oai:2'], [r.identifier for r in records])
        self.assertEquals([False, False, True], [r.isDeleted for r in records])

        result = jazz.oaiSelect(prefix='oai_dc', shouldCountHits=True, partition=Partition.create("2/2"))
        records = list(result.records)
        self.assertEquals(['oai:3', 'oai:4'], [r.identifier for r in records])
        self.assertEquals([False, False], [r.isDeleted for r in records])

        self.assertEquals({'total':5, 'deletes':1}, jazz.getNrOfRecords())
Example #2
0
 def testPartition(self):
     r = ResumptionToken(metadataPrefix='prefix', continueAfter='3', partition=Partition.create('1/2'))
     self.assertEquals('1/2', str(r.partition))
     self.assertResumptionToken(r)