Example #1
0
    def testReadPoints(self):

        dset_id = config.get("dset111_id")
        print("dset_id:", dset_id)

        # these are the properties of the /g1/g1.1/dset1.1.1. dataset in tall.h5
        dset_json = {"id": dset_id}
        dset_json["root"] = getRootObjId(dset_id)
        dset_json["type"] = {"class": "H5T_INTEGER", "base": "H5T_STD_I32BE"}
        dset_json["shape"] = {
            "class": "H5S_SIMPLE",
            "dims": [10, 10],
            "maxdims": [10, 10]
        }
        dset_json["layout"] = {"class": "H5D_CHUNKED", "dims": [10, 10]}

        chunk_id = 'c' + dset_id[1:] + "_0_0"

        params = {}
        params["dset_json"] = dset_json
        params["chunk_id"] = chunk_id
        params["bucket"] = config.get("bucket")
        loop = asyncio.get_event_loop()
        app = get_app(loop=loop)
        loop.run_until_complete(self.read_points_test(app, params))

        loop.close()
Example #2
0
    def testSchema2Id(self):
        root_id = createObjId("roots")
        group_id = createObjId("groups", rootid=root_id)
        dataset_id = createObjId("datasets", rootid=root_id)
        ctype_id = createObjId("datatypes", rootid=root_id)

        self.assertEqual(getCollectionForId(root_id), "groups")
        self.assertEqual(getCollectionForId(group_id), "groups")
        self.assertEqual(getCollectionForId(dataset_id), "datasets")
        self.assertEqual(getCollectionForId(ctype_id), "datatypes")
        chunk_id = 'c' + dataset_id[1:] + "_1_2"
        print(chunk_id)
        chunk_partition_id = 'c42-' + dataset_id[2:] + "_1_2"

        for id in (chunk_id, chunk_partition_id):
            try:
                getCollectionForId(id)
                self.assertTrue(False)
            except ValueError:
                pass  # expected
        valid_ids = (group_id, dataset_id, ctype_id, chunk_id,
                     chunk_partition_id, root_id)
        s3prefix = getS3Key(root_id)
        self.assertTrue(s3prefix.endswith("/.group.json"))
        s3prefix = s3prefix[:-(len(".group.json"))]
        for oid in valid_ids:
            print("oid:", oid)
            self.assertTrue(len(oid) >= 38)
            parts = oid.split('-')
            self.assertEqual(len(parts), 6)
            self.assertTrue(oid[0] in ('g', 'd', 't', 'c'))
            self.assertTrue(isSchema2Id(oid))
            if oid == root_id:
                self.assertTrue(isRootObjId(oid))
            else:
                self.assertFalse(isRootObjId(oid))
            self.assertEqual(getRootObjId(oid), root_id)

            s3key = getS3Key(oid)
            print(s3key)
            self.assertTrue(s3key.startswith(s3prefix))
            self.assertEqual(getObjId(s3key), oid)
            self.assertTrue(isS3ObjKey(s3key))