Beispiel #1
0
    def test_files(self):
        #    outfilename = "test_files"
        try:
            clip = FPClip(self.pool)
            clip.open(clipid, FPLibrary.FP_OPEN_ASTREE)

            numfiles = clip.getNumBlobs()
            assert numfiles, "Missing blobs"
            for i in range(numfiles + 1):
                blob_id = clip.fetchNext()
                if not blob_id:
                    break

                blob_tag = FPTag(blob_id)
                print(("tag: %r" % blob_tag))
                if blob_tag.getBlobSize() < 1:
                    print(("Empty blob %s" % i))
                    blob_tag.close()
                    continue

                outfilename = blob_tag.getTagName()
                print(("tag name : %s" % outfilename))
                fh = FPFileOutputStream(
                    "outfile.{name}.{i}".format(name=outfilename, i=i))
                print("reading file from centera...")
                blob_tag.blobRead(fh.stream, 0)
                print("ok")
                fh.close()
                blob_tag.close()

        finally:
            print("closing clip")
            clip.close()

        assert outfilename, "Missing tag: %r" % outfilename
Beispiel #2
0
    def test_description(self):
        expected_attributes = ['refid',
                               'name',
                               'modification.date',
                               'totalsize',
                               'clusterid',
                               'modification.profile',
                               'creation.date',
                               'retention.period',
                               'numfiles',
                               'prev.clip',
                               'creation.poolid',
                               'modification.poolid',
                               'numtags',
                               'creation.profile',
                               'type',
                               'sdk.version',
                               'clip.naming.scheme']

        clip = FPClip(self.pool)
        clip.open(clipid, FPLibrary.FP_OPEN_ASTREE)
        try:
            attributes = clip.getNumDescriptionAttributes()
            assert all(x in attributes for x in expected_attributes)
        finally:
            print("closing clip")
            clip.close()
Beispiel #3
0
    from Filepool.FPRetention import FPRetention
    from Filepool.util import parse_config

    config = parse_config("test/test.ini")
    ip = raw_input("Pool address: ") or config['test']['POOL_ADDRESS']
    clipid = clipid or config['test']['read_clipid']
    pool = FPPool(ip)
    pool.setGlobalOption(FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD,
                         100 * 1024)
    pool.getPoolInfo()
    # the application will be attached to the clip id
    pool.registerApplication("python wrapper read example", "1.0")

    clip = FPClip(pool)
    # clipid = raw_input( "Clip id: " )
    clip.open(clipid, FPLibrary.FP_OPEN_ASTREE)

    for a in "name retention.period numfiles".split():
        clip.getDescriptionAttribute(a)

    top = clip.getTopTag()
    print("tag: %r" % top)

    for i in range(clip.getNumBlobs() + 1):
        blob_id = clip.fetchNext()
        if not blob_id:
            break

        blob_tag = FPTag(blob_id)
        if blob_tag.getBlobSize() < 1:
            blob_tag.close()
Beispiel #4
0
    from Filepool.FPRetention import FPRetention
    from Filepool.util import parse_config

    config = parse_config("test/test.ini")
    ip = raw_input("Pool address: ") or config['test']['POOL_ADDRESS']
    clipid = clipid or config['test']['read_clipid']
    pool = FPPool(ip)
    pool.setGlobalOption(FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD,
                         100 * 1024)
    pool.getPoolInfo()
    # the application will be attached to the clip id
    pool.registerApplication("python wrapper read example", "1.0")

    clip = FPClip(pool)
    # clipid = raw_input( "Clip id: " )
    clip.open(clipid, FPLibrary.FP_OPEN_ASTREE)

    for a in "name retention.period numfiles".split():
        clip.getDescriptionAttribute(a)

    top = clip.getTopTag()
    print("tag: %r" % top)

    for i in range(clip.getNumBlobs() + 1):
        blob_id = clip.fetchNext()
        if not blob_id:
            break

        blob_tag = FPTag(blob_id)
        if blob_tag.getBlobSize() < 1:
            blob_tag.close()