Browse Source

content dir: adjust tests after entity/class related types refactoring performed

iorveth 4 years ago
parent
commit
241bded185

+ 61 - 52
runtime-modules/content-directory/src/mock.rs

@@ -17,13 +17,14 @@ use std::cell::RefCell;
 
 /// Runtime Types
 
-type ClassId = <Runtime as Trait>::ClassId;
-type EntityId = <Runtime as Trait>::EntityId;
-type Nonce = <Runtime as Trait>::Nonce;
+pub type ClassId = <Runtime as Trait>::ClassId;
+pub type EntityId = <Runtime as Trait>::EntityId;
+pub type Nonce = <Runtime as Trait>::Nonce;
+pub type Hashed = <Runtime as system::Trait>::Hash;
 
-type CuratorId = <Runtime as ActorAuthenticator>::CuratorId;
+pub type CuratorId = <Runtime as ActorAuthenticator>::CuratorId;
 pub type CuratorGroupId = <Runtime as ActorAuthenticator>::CuratorGroupId;
-type MemberId = <Runtime as ActorAuthenticator>::MemberId;
+pub type MemberId = <Runtime as ActorAuthenticator>::MemberId;
 
 /// Origins
 
@@ -404,7 +405,7 @@ pub fn generate_text(len: usize) -> Vec<u8> {
     vec![b'x'; len]
 }
 
-impl<T: Trait> Property<T> {
+impl<ClassId: Default + BaseArithmetic + Clone + Copy> Property<ClassId> {
     pub fn required(mut self) -> Self {
         self.required = true;
         self
@@ -423,10 +424,10 @@ type RawTestEvent = RawEvent<
     CuratorId,
     ClassId,
     EntityId,
-    EntityController<Runtime>,
+    EntityController<MemberId>,
     EntityCreationVoucher<Runtime>,
     bool,
-    Actor<Runtime>,
+    Actor<CuratorGroupId, CuratorId, MemberId>,
     Nonce,
     Option<ReferenceCounterSideEffects<Runtime>>,
     Option<(EntityId, EntityReferenceCounterSideEffect)>,
@@ -581,7 +582,7 @@ pub fn create_simple_class(lead_origin: u64, class_type: ClassType) -> DispatchR
     )
 }
 
-pub fn create_class_with_default_permissions() -> Class<Runtime> {
+pub fn create_class_with_default_permissions() -> Class<EntityId, ClassId, CuratorGroupId> {
     Class::new(
         ClassPermissions::default(),
         generate_text(ClassNameLengthConstraint::get().max() as usize),
@@ -633,7 +634,7 @@ pub fn add_class_schema(
     lead_origin: u64,
     class_id: ClassId,
     existing_properties: BTreeSet<PropertyId>,
-    new_properties: Vec<Property<Runtime>>,
+    new_properties: Vec<Property<ClassId>>,
 ) -> DispatchResult {
     TestModule::add_class_schema(
         Origin::signed(lead_origin),
@@ -656,7 +657,7 @@ pub fn next_class_id() -> ClassId {
     TestModule::next_class_id()
 }
 
-pub fn class_by_id(class_id: ClassId) -> Class<Runtime> {
+pub fn class_by_id(class_id: ClassId) -> Class<EntityId, ClassId, CuratorGroupId> {
     TestModule::class_by_id(class_id)
 }
 
@@ -669,7 +670,7 @@ pub fn class_exists(class_id: ClassId) -> bool {
 pub fn update_entity_creation_voucher(
     lead_origin: u64,
     class_id: ClassId,
-    controller: EntityController<Runtime>,
+    controller: EntityController<MemberId>,
     maximum_entities_count: EntityId,
 ) -> DispatchResult {
     TestModule::update_entity_creation_voucher(
@@ -682,14 +683,14 @@ pub fn update_entity_creation_voucher(
 
 pub fn entity_creation_vouchers(
     class_id: ClassId,
-    entity_controller: &EntityController<Runtime>,
+    entity_controller: &EntityController<MemberId>,
 ) -> EntityCreationVoucher<Runtime> {
     TestModule::entity_creation_vouchers(class_id, entity_controller)
 }
 
 pub fn entity_creation_voucher_exists(
     class_id: ClassId,
-    entity_controller: &EntityController<Runtime>,
+    entity_controller: &EntityController<MemberId>,
 ) -> bool {
     EntityCreationVouchers::<Runtime>::contains_key(class_id, entity_controller)
 }
@@ -700,7 +701,7 @@ pub fn entity_exists(entity_id: EntityId) -> bool {
     EntityById::<Runtime>::contains_key(entity_id)
 }
 
-pub fn entity_by_id(entity_id: EntityId) -> Entity<Runtime> {
+pub fn entity_by_id(entity_id: EntityId) -> Entity<ClassId, MemberId, Hashed, EntityId, Nonce> {
     TestModule::entity_by_id(entity_id)
 }
 
@@ -708,11 +709,19 @@ pub fn next_entity_id() -> EntityId {
     TestModule::next_entity_id()
 }
 
-pub fn create_entity(origin: u64, class_id: ClassId, actor: Actor<Runtime>) -> DispatchResult {
+pub fn create_entity(
+    origin: u64,
+    class_id: ClassId,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
+) -> DispatchResult {
     TestModule::create_entity(Origin::signed(origin), class_id, actor)
 }
 
-pub fn remove_entity(origin: u64, actor: Actor<Runtime>, entity_id: EntityId) -> DispatchResult {
+pub fn remove_entity(
+    origin: u64,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
+    entity_id: EntityId,
+) -> DispatchResult {
     TestModule::remove_entity(Origin::signed(origin), actor, entity_id)
 }
 
@@ -732,7 +741,7 @@ pub fn update_entity_permissions(
 
 pub fn add_schema_support_to_entity(
     origin: u64,
-    actor: Actor<Runtime>,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
     entity_id: EntityId,
     schema_id: SchemaId,
     new_property_values: BTreeMap<PropertyId, InputPropertyValue<Runtime>>,
@@ -748,7 +757,7 @@ pub fn add_schema_support_to_entity(
 
 pub fn update_entity_property_values(
     origin: u64,
-    actor: Actor<Runtime>,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
     entity_id: EntityId,
     new_property_values: BTreeMap<PropertyId, InputPropertyValue<Runtime>>,
 ) -> DispatchResult {
@@ -762,7 +771,7 @@ pub fn update_entity_property_values(
 
 pub fn clear_entity_property_vector(
     origin: u64,
-    actor: Actor<Runtime>,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
     entity_id: EntityId,
     in_class_schema_property_id: PropertyId,
 ) -> DispatchResult {
@@ -776,7 +785,7 @@ pub fn clear_entity_property_vector(
 
 pub fn insert_at_entity_property_vector(
     origin: u64,
-    actor: Actor<Runtime>,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
     entity_id: EntityId,
     in_class_schema_property_id: PropertyId,
     index_in_property_vector: VecMaxLength,
@@ -796,7 +805,7 @@ pub fn insert_at_entity_property_vector(
 
 pub fn remove_at_entity_property_vector(
     origin: u64,
-    actor: Actor<Runtime>,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
     entity_id: EntityId,
     in_class_schema_property_id: PropertyId,
     index_in_property_vector: VecMaxLength,
@@ -815,7 +824,7 @@ pub fn remove_at_entity_property_vector(
 pub fn transfer_entity_ownership(
     origin: u64,
     entity_id: EntityId,
-    new_controller: EntityController<Runtime>,
+    new_controller: EntityController<MemberId>,
     new_property_value_references_with_same_owner_flag_set: BTreeMap<
         PropertyId,
         InputPropertyValue<Runtime>,
@@ -833,7 +842,7 @@ pub fn transfer_entity_ownership(
 
 pub fn transaction(
     origin: u64,
-    actor: Actor<Runtime>,
+    actor: Actor<CuratorGroupId, CuratorId, MemberId>,
     operations: Vec<OperationType<Runtime>>,
 ) -> DispatchResult {
     TestModule::transaction(Origin::signed(origin), actor, operations)
@@ -849,20 +858,20 @@ pub enum InvalidPropertyType {
     VecIsTooLong,
 }
 
-impl<T: Trait> Property<T> {
+impl Property<ClassId> {
     pub fn default_with_name(name_len: usize) -> Self {
         let name = generate_text(name_len);
         let description = generate_text(PropertyDescriptionLengthConstraint::get().min() as usize);
         Self {
             name,
             description,
-            ..Property::<T>::default()
+            ..Property::<ClassId>::default()
         }
     }
 
     pub fn with_name_and_type(
         name_len: usize,
-        property_type: PropertyType<T>,
+        property_type: PropertyType<ClassId>,
         required: bool,
         unique: bool,
     ) -> Self {
@@ -874,12 +883,12 @@ impl<T: Trait> Property<T> {
             property_type,
             required,
             unique,
-            ..Property::<T>::default()
+            ..Property::<ClassId>::default()
         }
     }
 
-    pub fn invalid(invalid_property_type: InvalidPropertyType) -> Property<Runtime> {
-        let mut default_property = Property::<Runtime>::default_with_name(
+    pub fn invalid(invalid_property_type: InvalidPropertyType) -> Property<ClassId> {
+        let mut default_property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().min() as usize,
         );
         match invalid_property_type {
@@ -901,16 +910,16 @@ impl<T: Trait> Property<T> {
             }
             InvalidPropertyType::TextIsTooLong => {
                 default_property.property_type =
-                    PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get() + 1);
+                    PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get() + 1);
             }
             InvalidPropertyType::TextHashIsTooLong => {
                 if let Some(hashed_text_max_len) = HashedTextMaxLengthConstraint::get() {
                     default_property.property_type =
-                        PropertyType::<Runtime>::single_text_hash(Some(hashed_text_max_len + 1));
+                        PropertyType::<ClassId>::single_text_hash(Some(hashed_text_max_len + 1));
                 }
             }
             InvalidPropertyType::VecIsTooLong => {
-                default_property.property_type = PropertyType::<Runtime>::vec_reference(
+                default_property.property_type = PropertyType::<ClassId>::vec_reference(
                     FIRST_CLASS_ID,
                     true,
                     VecMaxLengthConstraint::get() + 1,
@@ -921,43 +930,43 @@ impl<T: Trait> Property<T> {
     }
 }
 
-impl<T: Trait> PropertyType<T> {
+impl PropertyType<ClassId> {
     pub fn vec_reference(
         class_id: ClassId,
         same_controller: bool,
         max_length: VecMaxLength,
-    ) -> PropertyType<Runtime> {
-        let vec_type = Type::<Runtime>::Reference(class_id, same_controller);
-        let vec_reference = VecPropertyType::<Runtime>::new(vec_type, max_length);
-        PropertyType::<Runtime>::Vector(vec_reference)
+    ) -> PropertyType<ClassId> {
+        let vec_type = Type::<ClassId>::Reference(class_id, same_controller);
+        let vec_reference = VecPropertyType::<ClassId>::new(vec_type, max_length);
+        PropertyType::<ClassId>::Vector(vec_reference)
     }
 
     pub fn vec_text(
         text_max_len: TextMaxLength,
         vec_max_length: VecMaxLength,
-    ) -> PropertyType<Runtime> {
-        let vec_type = Type::<Runtime>::Text(text_max_len);
-        let vec_text = VecPropertyType::<Runtime>::new(vec_type, vec_max_length);
-        PropertyType::<Runtime>::Vector(vec_text)
+    ) -> PropertyType<ClassId> {
+        let vec_type = Type::<ClassId>::Text(text_max_len);
+        let vec_text = VecPropertyType::<ClassId>::new(vec_type, vec_max_length);
+        PropertyType::<ClassId>::Vector(vec_text)
     }
 
-    pub fn single_text(text_max_len: TextMaxLength) -> PropertyType<Runtime> {
-        let text_type = Type::<Runtime>::Text(text_max_len);
-        PropertyType::<Runtime>::Single(text_type)
+    pub fn single_text(text_max_len: TextMaxLength) -> PropertyType<ClassId> {
+        let text_type = Type::<ClassId>::Text(text_max_len);
+        PropertyType::<ClassId>::Single(text_type)
     }
 
-    pub fn single_text_hash(text_hash_max_len: HashedTextMaxLength) -> PropertyType<Runtime> {
-        let text_type = Type::<Runtime>::Hash(text_hash_max_len);
-        PropertyType::<Runtime>::Single(text_type)
+    pub fn single_text_hash(text_hash_max_len: HashedTextMaxLength) -> PropertyType<ClassId> {
+        let text_type = Type::<ClassId>::Hash(text_hash_max_len);
+        PropertyType::<ClassId>::Single(text_type)
     }
 
     pub fn vec_text_hash(
         text_hash_max_len: HashedTextMaxLength,
         vec_max_length: VecMaxLength,
-    ) -> PropertyType<Runtime> {
-        let vec_type = Type::<Runtime>::Hash(text_hash_max_len);
-        let vec_text_hash = VecPropertyType::<Runtime>::new(vec_type, vec_max_length);
-        PropertyType::<Runtime>::Vector(vec_text_hash)
+    ) -> PropertyType<ClassId> {
+        let vec_type = Type::<ClassId>::Hash(text_hash_max_len);
+        let vec_text_hash = VecPropertyType::<ClassId>::new(vec_type, vec_max_length);
+        PropertyType::<ClassId>::Vector(vec_text_hash)
     }
 }
 

+ 11 - 8
runtime-modules/content-directory/src/tests.rs

@@ -25,7 +25,10 @@ use super::*;
 use crate::mock::*;
 use core::iter::FromIterator;
 
-pub fn add_entity_schemas_support() -> (Entity<Runtime>, Entity<Runtime>) {
+pub fn add_entity_schemas_support() -> (
+    Entity<ClassId, MemberId, Hashed, EntityId, Nonce>,
+    Entity<ClassId, MemberId, Hashed, EntityId, Nonce>,
+) {
     // Create first class with default permissions
     assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
@@ -46,12 +49,12 @@ pub fn add_entity_schemas_support() -> (Entity<Runtime>, Entity<Runtime>) {
 
     // Create first property
     let first_property =
-        Property::<Runtime>::default_with_name(PropertyNameLengthConstraint::get().max() as usize);
+        Property::<ClassId>::default_with_name(PropertyNameLengthConstraint::get().max() as usize);
 
     // Create second property
-    let second_property_type = PropertyType::<Runtime>::vec_reference(SECOND_CLASS_ID, true, 5);
+    let second_property_type = PropertyType::<ClassId>::vec_reference(SECOND_CLASS_ID, true, 5);
 
-    let second_property = Property::<Runtime>::with_name_and_type(
+    let second_property = Property::<ClassId>::with_name_and_type(
         (PropertyNameLengthConstraint::get().max() - 1) as usize,
         second_property_type,
         true,
@@ -162,7 +165,7 @@ pub enum EntityAccessStateFailureType {
 
 pub fn emulate_entity_access_state_for_failure_case(
     entity_access_level_failure_type: EntityAccessStateFailureType,
-) -> Actor<Runtime> {
+) -> Actor<CuratorGroupId, CuratorId, MemberId> {
     // Create class with default permissions
     assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
@@ -305,9 +308,9 @@ pub fn emulate_entity_access_state_for_failure_case(
 pub fn add_unique_class_reference_schema() {
     // Create property
     let property_type =
-        PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, VecMaxLengthConstraint::get());
+        PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, VecMaxLengthConstraint::get());
 
-    let property = Property::<Runtime>::with_name_and_type(
+    let property = Property::<ClassId>::with_name_and_type(
         (PropertyNameLengthConstraint::get().max() - 1) as usize,
         property_type,
         true,
@@ -325,7 +328,7 @@ pub fn add_unique_class_reference_schema() {
 
 ///  Create class reference schema and add corresponding schema support to the Entity
 pub fn add_unique_class_reference_schema_and_entity_schema_support(
-    actor: &Actor<Runtime>,
+    actor: &Actor<CuratorGroupId, CuratorId, MemberId>,
     origin: u64,
 ) {
     add_unique_class_reference_schema();

+ 9 - 9
runtime-modules/content-directory/src/tests/add_class_schema.rs

@@ -303,7 +303,7 @@ fn add_class_schema_property_name_too_long() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let property = Property::<Runtime>::invalid(InvalidPropertyType::NameTooLong);
+        let property = Property::<ClassId>::invalid(InvalidPropertyType::NameTooLong);
 
         // Make an attempt to add class schema, providing property with name, which length exceeds PropertyNameLengthConstraint
         let add_class_schema_result =
@@ -329,7 +329,7 @@ fn add_class_schema_property_name_too_short() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let property = Property::<Runtime>::invalid(InvalidPropertyType::NameTooShort);
+        let property = Property::<ClassId>::invalid(InvalidPropertyType::NameTooShort);
 
         // Make an attempt to add class schema, providing property with name, which length is less than min value of PropertyNameLengthConstraint
         let add_class_schema_result =
@@ -355,7 +355,7 @@ fn add_class_schema_property_description_too_long() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let property = Property::<Runtime>::invalid(InvalidPropertyType::DescriptionTooLong);
+        let property = Property::<ClassId>::invalid(InvalidPropertyType::DescriptionTooLong);
 
         // Make an attempt to add class schema, providing property with description, which length exceeds PropertyDescriptionLengthConstraint
         let add_class_schema_result =
@@ -381,7 +381,7 @@ fn add_class_schema_property_description_too_short() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let property = Property::<Runtime>::invalid(InvalidPropertyType::DescriptionTooShort);
+        let property = Property::<ClassId>::invalid(InvalidPropertyType::DescriptionTooShort);
 
         // Make an attempt to add class schema, providing property with description, which length is less than min value of PropertyDescriptionLengthConstraint
         let add_class_schema_result =
@@ -407,7 +407,7 @@ fn add_class_schema_text_property_is_too_long() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let property = Property::<Runtime>::invalid(InvalidPropertyType::TextIsTooLong);
+        let property = Property::<ClassId>::invalid(InvalidPropertyType::TextIsTooLong);
 
         // Make an attempt to add class schema, providing property with Text type, which TextMaxLength exceeds corresponding TextMaxLengthConstraint
         let add_class_schema_result =
@@ -433,7 +433,7 @@ fn add_class_schema_text_hash_property_is_too_long() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let property = Property::<Runtime>::invalid(InvalidPropertyType::TextHashIsTooLong);
+        let property = Property::<ClassId>::invalid(InvalidPropertyType::TextHashIsTooLong);
 
         // Make an attempt to add class schema, providing property with Hash type,
         // which HashedTextMaxLength exceeds corresponding HashedTextMaxLengthConstraint
@@ -460,7 +460,7 @@ fn add_class_schema_property_vec_property_is_too_long() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let property = Property::<Runtime>::invalid(InvalidPropertyType::VecIsTooLong);
+        let property = Property::<ClassId>::invalid(InvalidPropertyType::VecIsTooLong);
 
         // Make an attempt to add class schema, providing Vector property, which VecMaxLength exceeds corresponding VecMaxLengthConstraint
         let add_class_schema_result =
@@ -486,12 +486,12 @@ fn add_class_schema_property_refers_unknown_class() {
         // Events number before tested calls
         let number_of_events_before_call = System::events().len();
 
-        let reference_vec_type = PropertyType::<Runtime>::vec_reference(
+        let reference_vec_type = PropertyType::<ClassId>::vec_reference(
             UNKNOWN_CLASS_ID,
             true,
             VecMaxLengthConstraint::get(),
         );
-        let property = Property::<Runtime>::with_name_and_type(1, reference_vec_type, true, true);
+        let property = Property::<ClassId>::with_name_and_type(1, reference_vec_type, true, true);
 
         // Make an attempt to add class schema, providing property with Type::Reference, which refers to unknown ClassId
         let add_class_schema_result =

+ 38 - 38
runtime-modules/content-directory/src/tests/add_schema_support_to_entity.rs

@@ -22,7 +22,7 @@ fn add_schema_support_to_non_existent_entity() {
         );
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -68,7 +68,7 @@ fn add_schema_support_lead_auth_failed() {
         );
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -114,7 +114,7 @@ fn add_schema_support_member_auth_failed() {
         );
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -167,7 +167,7 @@ fn add_schema_support_curator_group_is_not_active() {
         ));
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -213,7 +213,7 @@ fn add_schema_support_curator_auth_failed() {
         );
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -260,7 +260,7 @@ fn add_schema_support_curator_not_found_in_curator_group() {
         );
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -307,7 +307,7 @@ fn add_schema_support_access_denied() {
         );
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -391,7 +391,7 @@ fn add_schema_support_to_entity_class_property_not_found() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -442,7 +442,7 @@ fn add_schema_support_already_added_to_the_entity() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -501,7 +501,7 @@ fn add_schema_support_already_contains_given_property_id() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create first property
-        let first_property = Property::<Runtime>::default_with_name(
+        let first_property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -515,8 +515,8 @@ fn add_schema_support_already_contains_given_property_id() {
 
         // Create second property
         let second_property_type =
-            PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get());
-        let second_property = Property::<Runtime>::with_name_and_type(
+            PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get());
+        let second_property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize - 1,
             second_property_type,
             true,
@@ -583,7 +583,7 @@ fn add_schema_support_is_not_active() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -642,7 +642,7 @@ fn add_schema_support_does_not_contain_provided_property_id() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create first property
-        let first_property = Property::<Runtime>::default_with_name(
+        let first_property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -655,7 +655,7 @@ fn add_schema_support_does_not_contain_provided_property_id() {
         ));
 
         // Create second property
-        let second_property = Property::<Runtime>::default_with_name(
+        let second_property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize - 1,
         );
 
@@ -706,14 +706,14 @@ fn add_schema_support_missing_required_property() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create first property
-        let first_property = Property::<Runtime>::default_with_name(
+        let first_property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
         // Create second property
         let second_property_type =
-            PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get());
-        let second_property = Property::<Runtime>::with_name_and_type(
+            PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get());
+        let second_property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize - 1,
             second_property_type,
             true,
@@ -766,8 +766,8 @@ fn add_schema_support_dont_match_type() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get());
-        let property = Property::<Runtime>::with_name_and_type(
+        let property_type = PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get());
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize - 1,
             property_type,
             true,
@@ -836,9 +836,9 @@ fn add_schema_support_referenced_entity_does_not_match_class() {
         ));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, 5);
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -898,9 +898,9 @@ fn add_schema_support_referenced_entity_does_not_exist() {
         assert_ok!(create_entity(LEAD_ORIGIN, FIRST_CLASS_ID, actor.to_owned()));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(SECOND_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(SECOND_CLASS_ID, true, 5);
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -970,9 +970,9 @@ fn add_schema_support_entity_can_not_be_referenced() {
         ));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, 5);
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -1046,9 +1046,9 @@ fn add_schema_support_same_controller_constraint_violation() {
         ));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, 5);
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -1105,9 +1105,9 @@ fn add_schema_support_text_property_is_too_long() {
         assert_ok!(create_entity(LEAD_ORIGIN, FIRST_CLASS_ID, actor.to_owned()));
 
         // Create text property
-        let property_type = PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get());
+        let property_type = PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get());
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,
@@ -1168,9 +1168,9 @@ fn add_schema_support_text_hash_property_is_too_long() {
 
         // Create hash property
         let property_type =
-            PropertyType::<Runtime>::single_text_hash(hashed_text_max_length_constraint);
+            PropertyType::<ClassId>::single_text_hash(hashed_text_max_length_constraint);
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,
@@ -1239,13 +1239,13 @@ fn add_schema_support_vec_property_is_too_long() {
         ));
 
         // Create vec property
-        let property_type = PropertyType::<Runtime>::vec_reference(
+        let property_type = PropertyType::<ClassId>::vec_reference(
             SECOND_CLASS_ID,
             true,
             VecMaxLengthConstraint::get(),
         );
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -1306,11 +1306,11 @@ fn add_schema_support_property_should_be_unique() {
         // Create second entity
         assert_ok!(create_entity(LEAD_ORIGIN, FIRST_CLASS_ID, actor.to_owned()));
 
-        let property_type = PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get());
+        let property_type = PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get());
 
         // Create text property
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,
@@ -1382,11 +1382,11 @@ fn add_schema_support_properties_should_be_unique() {
         // Create third entity
         assert_ok!(create_entity(LEAD_ORIGIN, FIRST_CLASS_ID, actor.to_owned()));
 
-        let property_type = PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get());
+        let property_type = PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get());
 
         // Create text property
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,

+ 3 - 3
runtime-modules/content-directory/src/tests/clear_entity_property_vector.rs

@@ -359,9 +359,9 @@ fn clear_entity_property_vector_is_locked_for_given_actor() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, 5);
 
-        let mut property = Property::<Runtime>::with_name_and_type(
+        let mut property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -457,7 +457,7 @@ fn clear_entity_property_vector_value_under_given_index_is_not_a_vector() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 

+ 2 - 2
runtime-modules/content-directory/src/tests/create_entity.rs

@@ -47,7 +47,7 @@ fn create_entity_success() {
             EntityCreationVoucher::new(class.get_default_entity_creation_voucher_upper_bound());
         entity_voucher.increment_created_entities_count();
 
-        let entity_controller = EntityController::from_actor(&actor);
+        let entity_controller = EntityController::<MemberId>::from_actor::<Runtime>(&actor);
 
         assert_eq!(
             entity_creation_vouchers(FIRST_CLASS_ID, &entity_controller),
@@ -55,7 +55,7 @@ fn create_entity_success() {
         );
 
         // Ensure new entity created
-        let entity = Entity::<Runtime>::new(
+        let entity = Entity::<ClassId, MemberId, Hashed, EntityId, Nonce>::new(
             entity_controller,
             FIRST_CLASS_ID,
             BTreeSet::new(),

+ 9 - 9
runtime-modules/content-directory/src/tests/insert_at_entity_property_vector.rs

@@ -456,9 +456,9 @@ fn insert_at_entity_property_vector_is_locked_for_given_actor() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, 5);
 
-        let mut property = Property::<Runtime>::with_name_and_type(
+        let mut property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -579,7 +579,7 @@ fn insert_at_entity_property_vector_value_under_given_index_is_not_a_vector() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 
@@ -818,12 +818,12 @@ fn insert_at_entity_property_vector_text_prop_is_too_long() {
         assert_ok!(create_entity(LEAD_ORIGIN, FIRST_CLASS_ID, actor.clone()));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_text(
+        let property_type = PropertyType::<ClassId>::vec_text(
             TextMaxLengthConstraint::get(),
             VecMaxLengthConstraint::get(),
         );
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -898,12 +898,12 @@ fn insert_at_entity_property_vector_hashed_text_prop_is_too_long() {
         let hashed_text_max_length_constraint = HashedTextMaxLengthConstraint::get();
 
         // Create vec text hash property
-        let property_type = PropertyType::<Runtime>::vec_text_hash(
+        let property_type = PropertyType::<ClassId>::vec_text_hash(
             hashed_text_max_length_constraint,
             VecMaxLengthConstraint::get(),
         );
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,
@@ -977,12 +977,12 @@ fn insert_at_entity_property_vector_prop_type_does_not_match_internal_vec_proper
         assert_ok!(create_entity(LEAD_ORIGIN, FIRST_CLASS_ID, actor.clone()));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_text(
+        let property_type = PropertyType::<ClassId>::vec_text(
             TextMaxLengthConstraint::get(),
             VecMaxLengthConstraint::get(),
         );
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,

+ 3 - 3
runtime-modules/content-directory/src/tests/remove_at_entity_property_vector.rs

@@ -430,9 +430,9 @@ fn remove_at_entity_property_vector_is_locked_for_given_actor() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, 5);
 
-        let mut property = Property::<Runtime>::with_name_and_type(
+        let mut property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -549,7 +549,7 @@ fn remove_at_entity_property_vector_value_under_given_index_is_not_a_vector() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property = Property::<Runtime>::default_with_name(
+        let property = Property::<ClassId>::default_with_name(
             PropertyNameLengthConstraint::get().max() as usize,
         );
 

+ 1 - 1
runtime-modules/content-directory/src/tests/remove_entity.rs

@@ -27,7 +27,7 @@ fn remove_entity_success() {
         // Ensure number of entities_created under respective entity creation voucher decremented succesfully.
         let entity_voucher = EntityCreationVoucher::new(IndividualEntitiesCreationLimit::get());
 
-        let entity_controller = EntityController::from_actor(&actor);
+        let entity_controller = EntityController::<MemberId>::from_actor::<Runtime>(&actor);
 
         assert_eq!(
             entity_creation_vouchers(FIRST_CLASS_ID, &entity_controller),

+ 1 - 1
runtime-modules/content-directory/src/tests/transaction.rs

@@ -8,7 +8,7 @@ fn transaction_success() {
 
         // Create single reference property
         let property_type_reference = Type::Reference(FIRST_CLASS_ID, true);
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             PropertyType::Single(property_type_reference),
             true,

+ 2 - 2
runtime-modules/content-directory/src/tests/transfer_entity_ownership.rs

@@ -616,13 +616,13 @@ fn transfer_entity_ownership_unique_constraint_violation() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create unique reference property with same_controller flag set
-        let property_type = PropertyType::<Runtime>::vec_reference(
+        let property_type = PropertyType::<ClassId>::vec_reference(
             FIRST_CLASS_ID,
             true,
             VecMaxLengthConstraint::get(),
         );
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,

+ 1 - 1
runtime-modules/content-directory/src/tests/update_entity_creation_voucher.rs

@@ -65,7 +65,7 @@ fn update_entity_creation_voucher_success() {
             None
         ));
 
-        let entity_controller = EntityController::from_actor(&actor);
+        let entity_controller = EntityController::<MemberId>::from_actor::<Runtime>(&actor);
 
         // Create entity
         assert_ok!(create_entity(FIRST_MEMBER_ORIGIN, FIRST_CLASS_ID, actor));

+ 6 - 6
runtime-modules/content-directory/src/tests/update_entity_property_values.rs

@@ -391,9 +391,9 @@ fn update_entity_property_values_is_locked_for_given_actor() {
         assert_ok!(create_simple_class(LEAD_ORIGIN, ClassType::Valid));
 
         // Create property
-        let property_type = PropertyType::<Runtime>::vec_reference(FIRST_CLASS_ID, true, 5);
+        let property_type = PropertyType::<ClassId>::vec_reference(FIRST_CLASS_ID, true, 5);
 
-        let mut property = Property::<Runtime>::with_name_and_type(
+        let mut property = Property::<ClassId>::with_name_and_type(
             (PropertyNameLengthConstraint::get().max() - 1) as usize,
             property_type,
             true,
@@ -605,9 +605,9 @@ fn update_entity_property_values_text_prop_is_too_long() {
         assert_ok!(create_entity(LEAD_ORIGIN, FIRST_CLASS_ID, actor.to_owned()));
 
         // Create text property
-        let property_type = PropertyType::<Runtime>::single_text(TextMaxLengthConstraint::get());
+        let property_type = PropertyType::<ClassId>::single_text(TextMaxLengthConstraint::get());
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,
@@ -682,9 +682,9 @@ fn update_entity_property_values_hashed_text_prop_is_too_long() {
 
         // Create hash property
         let property_type =
-            PropertyType::<Runtime>::single_text_hash(hashed_text_max_length_constraint);
+            PropertyType::<ClassId>::single_text_hash(hashed_text_max_length_constraint);
 
-        let property = Property::<Runtime>::with_name_and_type(
+        let property = Property::<ClassId>::with_name_and_type(
             PropertyNameLengthConstraint::get().max() as usize,
             property_type,
             true,