示例#1
0
    def test_unique_key(self):
        options = BitmapIndexOptions()

        options.unique_key = QueryConstants.THIS_ATTRIBUTE_NAME
        self.assertEqual(options.unique_key,
                         QueryConstants.THIS_ATTRIBUTE_NAME)

        options.unique_key = "KEY_ATTRIBUTE_NAME"
        self.assertEqual(options.unique_key, QueryConstants.KEY_ATTRIBUTE_NAME)

        with self.assertRaises(TypeError):
            options.unique_key = None
示例#2
0
    def test_unique_key_transformation(self):
        options = BitmapIndexOptions()

        options.unique_key_transformation = UniqueKeyTransformation.RAW
        self.assertEqual(options.unique_key_transformation,
                         UniqueKeyTransformation.RAW)

        options.unique_key_transformation = "LONG"
        self.assertEqual(options.unique_key_transformation,
                         UniqueKeyTransformation.LONG)

        with self.assertRaises(TypeError):
            options.unique_key_transformation = 132
 def decode(msg):
     msg.next_frame()
     initial_frame = msg.next_frame()
     unique_key_transformation = FixSizedTypesCodec.decode_int(initial_frame.buf, _UNIQUE_KEY_TRANSFORMATION_DECODE_OFFSET)
     unique_key = StringCodec.decode(msg)
     CodecUtil.fast_forward_to_end_frame(msg)
     return BitmapIndexOptions(unique_key, unique_key_transformation)
示例#4
0
 def test_from_dict_with_changes(self):
     options = BitmapIndexOptions.from_dict({
         "unique_key":
         QueryConstants.THIS_ATTRIBUTE_NAME,
     })
     self.assertEqual(QueryConstants.THIS_ATTRIBUTE_NAME,
                      options.unique_key)
     self.assertEqual(UniqueKeyTransformation.OBJECT,
                      options.unique_key_transformation)
示例#5
0
 def test_from_dict_defaults(self):
     options = BitmapIndexOptions.from_dict({})
     self.assertEqual(QueryConstants.KEY_ATTRIBUTE_NAME, options.unique_key)
     self.assertEqual(UniqueKeyTransformation.OBJECT,
                      options.unique_key_transformation)
示例#6
0
 def test_from_dict(self):
     with self.assertRaises(InvalidConfigurationError):
         BitmapIndexOptions.from_dict({"unknown_key": 1})