Andrea91

Untitled

Aug 14th, 2019
36
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @isTest
  2. global class SkyPartnerAPP_Test{
  3.  
  4. static Map<String,Object> input;
  5. static Map<String,Object> output;
  6. static Map<String,Object> options;
  7.  
  8. @testSetup static void setup(){
  9. NewCRM_TestDataFactory.createTestData();
  10. Pricebook2 standardBook = new Pricebook2(Id=Test.getStandardPricebookId(), IsActive = true, vlocity_cmt__IsDefault__c = true);
  11. update standardBook;
  12. Account accProva = new Account (Name='AccountTest');
  13. insert accProva;
  14.  
  15. Contract contrProva = new Contract(Name = 'ContrTest1', AccountId = accProva.Id, flag_Tnb__c = true, Order_Number__c = '2100057', Billing_Id__c = accProva.id, Status = 'FIRMATO', Causale_Cessazione__c = 'MULTIVISION');
  16. insert contrProva;
  17. contrProva.Status = 'COMPLETO';
  18. update contrProva;
  19.  
  20. Order orderProva = new Order(Name = 'OrderTest', ContractId = contrProva.Id, Status = 'Draft', Type ='CHANGE_CONSISTENCY', OG_OrderSubType__c = 'VOUCHER', EffectiveDate=date.Today());
  21. insert orderProva;
  22.  
  23. //[A.A. 20190814] - START
  24. vlocity_cmt__Promotion__c promotion = new vlocity_cmt__Promotion__c(vlocity_cmt__Code__c = 'promoCode');
  25. insert promotion;
  26. //[A.A. 20190814] - END
  27.  
  28.  
  29. }
  30.  
  31. @isTest global static void main_test() {
  32.  
  33. SkyPartnerAPP controller = new SkyPartnerAPP();
  34.  
  35. Map<String, Object> input = new Map<String, Object>();
  36. Map<String, Object> output = new Map<String, Object>();
  37. Map<String, Object> options = new Map<String, Object>();
  38. string method = '';
  39.  
  40. //******************************** invokeImplementationMethod
  41.  
  42. Object test = controller.invokeImplementationMethod(method, input, output, options);
  43.  
  44. List<PermissionSet> ps = [SELECT Id,Name From PermissionSet Where Name = 'Sales_DTT_Retail_NL'];
  45. List<Id> listaPermissionSetPartnerApp= new List<Id>();
  46. for(PermissionSet p:ps){
  47. listaPermissionSetPartnerApp.add(p.Id);
  48. }
  49. System.debug('FV - listaPermissionSetPartnerApp ' + listaPermissionSetPartnerApp);
  50.  
  51. List<PermissionSetAssignment> psa_result = [SELECT Id From PermissionSetAssignment Where AssigneeId = :UserInfo.getUserId() AND PermissionSetId in :listaPermissionSetPartnerApp];
  52.  
  53. System.debug('FV - psa_result: ' + psa_result);
  54.  
  55. if(psa_result==null || psa_result.size()==0){
  56.  
  57. User usr1 = [Select id from User where Id = :UserInfo.getUserId()];
  58.  
  59. System.runAs(usr1) {
  60.  
  61. PermissionSetAssignment psa = new PermissionSetAssignment(AssigneeId = UserInfo.getUserId(), PermissionSetId= listaPermissionSetPartnerApp.get(0));
  62. insert psa;
  63.  
  64. }
  65.  
  66. }
  67. Product2 proot = new Product2();
  68. proot.name = AssetUtilities.PRODUCT_CODE_L0_SKY_RESIDENTIAL;
  69. proot.ProductCode = AssetUtilities.PRODUCT_CODE_L0_SKY_RESIDENTIAL;
  70. proot.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  71. proot.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  72. insert proot;
  73.  
  74. Product2 prodTest2 = new Product2();
  75. prodTest2.name = AssetUtilities.PRODUCT_CODE_L0_SKY_RESIDENTIAL;
  76. prodTest2.ProductCode = AssetUtilities.PRODUCT_CODE_L2_TV_PACK;
  77. prodTest2.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  78. prodTest2.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  79. insert prodTest2;
  80.  
  81. Product2 prodTest3 = new Product2();
  82. prodTest3.name = AssetUtilities.PRODUCT_CODE_L4_CALCIO_DTT;
  83. prodTest3.ProductCode = AssetUtilities.PRODUCT_CODE_L4_CALCIO_DTT;
  84. prodTest3.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  85. prodTest3.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  86. insert prodTest3;
  87.  
  88. Product2 prodTest4 = new Product2();
  89. prodTest4.name = AssetUtilities.PRODUCT_CODE_L4_CALCIO_DTT;
  90. prodTest4.ProductCode = 'CHARGE_COSTITECNICI_DTT';
  91. prodTest4.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  92. prodTest4.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  93. prodTest4.VoucherSize__c = '1';
  94. insert prodTest4;
  95.  
  96. Product2 prodTest5 = new Product2();
  97. prodTest5.name = AssetUtilities.PRODUCT_CODE_L2_TV_PACK;
  98. prodTest5.ProductCode = AssetUtilities.PRODUCT_CODE_L2_TV_PACK;
  99. prodTest5.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  100. insert prodTest5;
  101.  
  102. Pricebook2 pricebookTest = [select id from Pricebook2 where isStandard=true];
  103.  
  104. pricebookEntry pbEntryTest = new pricebookEntry(UnitPrice = 0, Pricebook2Id = pricebookTest.id, Product2Id = prodTest2.id, UseStandardPrice = false);
  105. insert pbEntryTest;
  106.  
  107. pricebookEntry pbEntryTest2 = new pricebookEntry(UnitPrice = 0, Pricebook2Id = pricebookTest.id, Product2Id = prodTest4.id, UseStandardPrice = false);
  108. insert pbEntryTest2;
  109.  
  110. pricebookEntry pbEntryTest3 = new pricebookEntry(UnitPrice = 0, Pricebook2Id = pricebookTest.id, Product2Id = prodTest5.id, UseStandardPrice = false);
  111. insert pbEntryTest3;
  112.  
  113. Account accTest = new Account (Name='AccountTest2');
  114. insert accTest;
  115.  
  116. Contract contrTest = new Contract(Name = 'ContrTest2', AccountId = accTest.Id, flag_Tnb__c = true, Order_Number__c = '2100056', Billing_Id__c = accTest.id, Status = 'FIRMATO', Causale_Cessazione__c = 'MULTIVISION');
  117. insert contrTest;
  118. contrTest.Status = 'COMPLETO';
  119. update contrTest;
  120. contrTest.Status = 'ATTIVO';
  121. update contrTest;
  122.  
  123. Contact contTest = new Contact(LastName = 'Contact Prova', AccountId = accTest.id, Phone = '3358954789', OtherPhone = '3335688569', MobilePhone = '3358954789', Codice_Fiscale__c = 'FRCTFF89E23G554E');
  124. insert contTest;
  125. accTest.vlocity_cmt__PersonContactId__c = contTest.Id;
  126. update accTest;
  127.  
  128. Order orderTest = new Order(Name = 'OrderTest', ContractId = contrTest.Id, Status = 'Draft', Type ='CHANGE_CONSISTENCY', OG_OrderSubType__c = 'VOUCHER', EffectiveDate=date.Today(), Pricebook2Id = pricebookTest.id);
  129. insert orderTest;
  130.  
  131. Order orderTest2 = new Order(Name = 'OrderTest3', ContractId = contrTest.Id, Status = 'Draft', Type ='CHANGE_CONSISTENCY', OG_OrderSubType__c = 'VOUCHER', EffectiveDate=date.Today());
  132. insert orderTest2;
  133.  
  134.  
  135.  
  136. Asset root = new Asset();
  137. root.Product2Id = proot.Id;
  138. root.vlocity_cmt__ContractId__c = contrTest.id;
  139. root.AccountId = accTest.Id;
  140. root.ContactId = contTest.Id;
  141. root.name = AssetUtilities.ASSET_L0_SKY_RESIDENTIAL;
  142. root.vlocity_cmt__LineNumber__c = '0001';
  143. root.status = AssetUtilities.ASSET_STATUS_ATTIVO;
  144. root.Quantity = 1;
  145. root.OG_StatoMatricola__c = AssetUtilities.ASSET_STATUS_DA_ATTIVARE;
  146. root.vlocity_cmt__ProvisioningStatus__c = AssetUtilities.ASSET_PROVISIONING_STATUS_ACTIVE;
  147. root.vlocity_cmt__RecurringTotal__c = 50;
  148. root.OG_EnablementNumber__c = '12346578654';
  149. insert root;
  150.  
  151. Asset tvPack = new Asset();
  152. tvPack.Product2Id = prodTest3.Id;
  153. tvPack.vlocity_cmt__ContractId__c = contrTest.Id;
  154. tvPack.AccountId = accTest.Id;
  155. tvPack.ContactId = contTest.Id;
  156. tvPack.name = AssetUtilities.ASSET_L2_TV_PACK;
  157. tvPack.vlocity_cmt__LineNumber__c = '0001.0001.0004';
  158. tvPack.status = AssetUtilities.ASSET_STATUS_ATTIVO;
  159. //tvPack.vlocity_cmt__JSONAttribute__c = '{"Cat_Attr_002":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDWAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Number","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Number","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x54AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDgAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Entitlement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Entitlement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x4zAAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"MV","id":2,"displayText":"MV"},{"value":"BASE","id":1,"displayText":"BASE"}],"default":[],"selectedItem":{"value":"BASE","id":1,"displayText":"BASE"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCsAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x50AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"-","id":1,"displayText":"-"},{"value":"SMC","id":2,"displayText":"SMC"}],"default":[],"selectedItem":{"value":"SMC","id":2,"displayText":"SMC"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCxAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Piattaforma_di_fruizione","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Piattaforma di fruizione","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x51AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"IPTV","id":2,"displayText":"IPTV"},{"value":"DTH","id":1,"displayText":"DTH"}],"default":[],"selectedItem":{"value":"IPTV","id":2,"displayText":"IPTV"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDCAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x52AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDlAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso_Tech","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso Tech","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x53AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null}],"Cat_Attr_001":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oE5AAI","attributecategoryid__c":"a3e260000000hWbAAI","categorycode__c":"Cat_Attr_001","categoryname__c":"Attributi Generici","attributeuniquecode__c":"Authocode","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Authocode","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x55AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":1,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null}]}';
  160. tvPack.vlocity_cmt__JSONAttribute__c = '{"Cat_Attr_002":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDWAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Number","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Number","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x54AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDgAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Entitlement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Entitlement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x4zAAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"MV","id":2,"displayText":"MV"},{"value":"BASE","id":1,"displayText":"BASE"}],"default":[],"selectedItem":{"value":"BASE","id":1,"displayText":"BASE"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCsAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x50AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"-","id":1,"displayText":"-"},{"value":"SMC","id":2,"displayText":"SMC"}],"default":[],"selectedItem":{"value":"SMC","id":2,"displayText":"SMC"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCxAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Piattaforma_di_fruizione","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Piattaforma di fruizione","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x51AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"IPTV","id":2,"displayText":"IPTV"},{"value":"DTH","id":1,"displayText":"DTH"}],"default":[],"selectedItem":{"value":"IPTV","id":2,"displayText":"IPTV"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDCAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x52AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDlAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso_Tech","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso Tech","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x53AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null}],"Cat_Attr_001":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oE5AAI","attributecategoryid__c":"a3e260000000hWbAAI","categorycode__c":"Cat_Attr_001","categoryname__c":"Attributi Generici","attributeuniquecode__c":"Authocode","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Authocode","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x55AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":1,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null}]}';
  161. tvPack.OG_ParentId__c = root.Id;
  162. tvPack.ParentId = root.Id;
  163. tvPack.vlocity_cmt__ContractId__c = contrTest.id;
  164. tvPack.vlocity_cmt__ActivationDate__c = Date.Today();
  165. tvPack.Quantity = 1;
  166. tvPack.OG_EnablementNumber__c = '000404409096'; //serial code smart card
  167. tvPack.OG_XAssociazioneMatricolaDT__c = Date.Today();
  168. tvPack.OG_StatoMatricola__c = AssetUtilities.ASSET_STATUS_DA_ATTIVARE;
  169. tvPack.vlocity_cmt__ProvisioningStatus__c = AssetUtilities.ASSET_PROVISIONING_STATUS_ACTIVE;
  170. tvPack.vlocity_cmt__RecurringTotal__c = 50;
  171. insert tvPack;
  172.  
  173. Order o = [select id,vlocity_cmt__PriceListId__c from order Limit 1];
  174. o.Pricebook2Id = pricebookTest.id;
  175. update o;
  176.  
  177. OrderItem orderItTest = new OrderItem(OrderId = orderTest.id, PricebookEntryId = pbEntryTest.id, Quantity = 1, UnitPrice = 0, Product2Id = prodTest2.id);
  178. insert orderItTest;
  179.  
  180. OrderItem orderItTest2 = new OrderItem(OrderId = o.id, PricebookEntryId = pbEntryTest2.id, Quantity = 1, UnitPrice = 0, Product2Id = prodTest4.id);
  181. insert orderItTest2;
  182.  
  183. OrderItem orderItTest3 = new OrderItem(OrderId = o.id, PricebookEntryId = pbEntryTest3.id, Quantity = 1, UnitPrice = 0, Product2Id = prodTest5.id);
  184. insert orderItTest3;
  185.  
  186. Template_Stampa__c template = new Template_Stampa__c(Name = 'Template_Stampa', DS_View_Url__c ='http://siebelcoll.prj.skytv.it/ecommunications_ita/pdf',DS_view_location__c='addendum');
  187. insert template;
  188.  
  189. vlocity_cmt__AccountPriceAdjustment__c apc = new vlocity_cmt__AccountPriceAdjustment__c();
  190. apc.vlocity_cmt__ContractId__c = contrTest.Id;
  191. apc.vlocity_cmt__BillingAccountId__c = accTest.Id;
  192. insert apc;
  193.  
  194. Folder folder = [select id from Folder where Name = 'Public Folder'];
  195.  
  196. Case cs = new Case(AccountId = accTest.id, ContactId = contTest.Id);
  197. insert cs;
  198.  
  199. Case csWithParent = new Case(AccountId = accTest.id, ContactId = contTest.Id, ParentId = cs.Id);
  200. insert csWithParent;
  201.  
  202. //caso OK
  203. method= 'checkProfileUser';
  204. User usr1 = [Select id from User where Id = :UserInfo.getUserId()];
  205. input.put('userId',usr1.id);
  206. test = controller.invokeImplementationMethod(method, input, output, options);
  207. input.clear();
  208.  
  209. //Caso Exception
  210. method= 'checkProfileUser';
  211. test = controller.invokeImplementationMethod(method, input, output, options);
  212.  
  213. method= 'preliminaryCheck';
  214. input.put('isRetail',true);
  215. input.put('ContractId',contrTest.id);
  216. input.put('AccountId', accTest.Id);
  217. input.put('ContactId', contTest.Id);
  218.  
  219. test = controller.invokeImplementationMethod(method, input, output, options);
  220. input.clear();
  221.  
  222. //Caso Exception
  223. method= 'updateContractListino';
  224.  
  225. test = controller.invokeImplementationMethod(method, input, output, options);
  226.  
  227. //Caso OK
  228. method= 'updateContractListino';
  229. input.put('ContractId',contrTest.id);
  230.  
  231. test = controller.invokeImplementationMethod(method, input, output, options);
  232.  
  233. //Caso Exception
  234. method= 'saveOrder';
  235. test = controller.invokeImplementationMethod(method, input, output, options);
  236.  
  237. //Caso OK
  238. method= 'saveOrder';
  239. input.put('fdoId',o.id);
  240. input.put('ContractId', contrTest.Id);
  241. input.put('priceListAPPCode_name','Listino_SKY_App_DTT');
  242. input.put('ActivityCode','SKY8021');
  243. /*Set<String> costCodeSet = SkyCO_Utilities.retrieveConstantsValus( SkyCO_Utilities.costProductCode );
  244. system.debug('FV saveORder costCodeSet: '+costCodeSet);
  245.  
  246. List<OrderItem> clsOrderItemList = [SELECT Id,Product2.ProductCode FROM OrderItem WHERE OrderId =: o.id AND Product2.ProductCode IN: costCodeSet ];
  247. system.debug('FV saveORder test: '+clsOrderItemList.get(0).Product2.ProductCode);*/
  248. test = controller.invokeImplementationMethod(method, input, output, options);
  249.  
  250.  
  251. //[A.A. 20190814 - SKY Darling] - START
  252.  
  253. //Caso Exception
  254. method= 'getFinalPrice';
  255. test = controller.invokeImplementationMethod(method, input, output, options);
  256.  
  257. //Caso OK
  258. method= 'getFinalPrice';
  259. input.put('orderid', orderTest.id);
  260. input.put('productid', orderItTest3.Product2Id);
  261.  
  262. //[A.A. 20190814 - SKY Darling] - END
  263.  
  264. //[A.A. 20190814] - START
  265.  
  266. //Caso Exception
  267. method= 'checkPromoInfo';
  268. test = controller.invokeImplementationMethod(method, input, output, options);
  269.  
  270. //Caso OK
  271. method= 'checkPromoInfo';
  272. vlocity_cmt__Promotion__c promotion2 = [SELECT id FROM vlocity_cmt__Promotion__c WHERE id =: promotion.id];
  273. input.put('promoId', promotion2.id);
  274.  
  275. //[A.A. 20190813 ] - END
  276.  
  277. //Caso EXCEPTION
  278. /*method= 'getAccountInfo';
  279. test = controller.invokeImplementationMethod(method, input, output, options);
  280.  
  281. //Caso OK
  282. method= 'getAccountInfo';
  283. input.put('AccountId', accTest.Id);
  284. test = controller.invokeImplementationMethod(method, input, output, options);
  285.  
  286.  
  287.  
  288.  
  289. method= 'getCustomerContracts';
  290. input.put('customerCodiceFiscale','FRCTFF89E23G554E');
  291. input.put('customerCodiceContratto','2100056');
  292. test = controller.invokeImplementationMethod(method, input, output, options);
  293.  
  294. //CASO OK
  295. Map<String,Object> selections = new Map<String,Object>();
  296. method= 'getVoucher';
  297. selections.put('customerOtherPhoneSelection',true);
  298. selections.put('customerOtherPhone','3335688745');
  299. input.put('CHECKUSERDETAILS_at',selections);
  300. input.put('isRetail',true);
  301. input.put('ContractId',contrTest.id);
  302. input.put('AccountId', accTest.Id);
  303. input.put('ContactId', contTest.Id);
  304. test = controller.invokeImplementationMethod(method, input, output, options);
  305. input.clear();
  306.  
  307.  
  308.  
  309. //Caso EXCEPTION
  310. method= 'getVoucher';
  311.  
  312. selections.put('customerOtherPhoneSelection',true);
  313. selections.put('customerOtherPhone','3335688745');
  314. input.put('CHECKUSERDETAILS_at',selections);
  315. input.put('isRetail',true);
  316. test = controller.invokeImplementationMethod(method, input, output, options);
  317.  
  318.  
  319.  
  320. method= 'sendOrder';
  321. input.put('fdoId',o.id);
  322. input.put('ContractId',contrTest.id);
  323. input.put('ParentCaseId',cs.id);
  324. input.put('CaseId',csWithParent.id);
  325. test = controller.invokeImplementationMethod(method, input, output, options);
  326.  
  327.  
  328.  
  329.  
  330. method= 'printAddendum';
  331. test = controller.invokeImplementationMethod(method, input, output, options);
  332. NewCrm_RetailSupportClass.ws_outputRetail ws_output_test = new NewCrm_RetailSupportClass.ws_outputRetail();
  333. ws_output_test.Esito='OK';
  334. ws_output_test.FileNamePDF='8A7F059BCDF0DCC14558.pdf';
  335. ws_output_test.Tid='C0A8A7F059BCDF0DCC145589';
  336. SkyPartnerAPP.ws_outputTestClass = ws_output_test;
  337. input.put('ContractId',contrTest.id);
  338. input.put('ContactId', contTest.Id);
  339. input.put('CaseId',cs.id);
  340. input.put('fdoId',o.id);
  341.  
  342. test = controller.invokeImplementationMethod(method, input, output, options);
  343. document docTemp = new Document(Name = 'Template4', FolderId = folder.id);
  344. insert docTemp;
  345. ws_output_test.Esito='KO';
  346. SkyPartnerAPP.ws_outputTestClass = ws_output_test;
  347. test = controller.invokeImplementationMethod(method, input, output, options);*/
  348.  
  349. System.Test.startTest();
  350. try{
  351. controller.calculatePriceForCPQ(o.Id);
  352. }catch (Exception e){}
  353. System.Test.stopTest();
  354.  
  355.  
  356. }
  357.  
  358. @isTest global static void main_test2() {
  359.  
  360. SkyPartnerAPP controller = new SkyPartnerAPP();
  361.  
  362. Map<String, Object> input = new Map<String, Object>();
  363. Map<String, Object> output = new Map<String, Object>();
  364. Map<String, Object> options = new Map<String, Object>();
  365. string method = '';
  366.  
  367. //******************************** invokeImplementationMethod
  368.  
  369. Object test = controller.invokeImplementationMethod(method, input, output, options);
  370.  
  371. List<PermissionSet> ps = [SELECT Id,Name From PermissionSet Where Name = 'Sales_DTT_Retail_NL'];
  372. List<Id> listaPermissionSetPartnerApp= new List<Id>();
  373. for(PermissionSet p:ps){
  374. listaPermissionSetPartnerApp.add(p.Id);
  375. }
  376. System.debug('FV - listaPermissionSetPartnerApp ' + listaPermissionSetPartnerApp);
  377.  
  378. List<PermissionSetAssignment> psa_result = [SELECT Id From PermissionSetAssignment Where AssigneeId = :UserInfo.getUserId() AND PermissionSetId in :listaPermissionSetPartnerApp];
  379.  
  380. System.debug('FV - psa_result: ' + psa_result);
  381.  
  382. if(psa_result==null || psa_result.size()==0){
  383.  
  384. User usr1 = [Select id from User where Id = :UserInfo.getUserId()];
  385.  
  386. System.runAs(usr1) {
  387.  
  388. PermissionSetAssignment psa = new PermissionSetAssignment(AssigneeId = UserInfo.getUserId(), PermissionSetId= listaPermissionSetPartnerApp.get(0));
  389. insert psa;
  390.  
  391. }
  392.  
  393. }
  394. Product2 proot = new Product2();
  395. proot.name = AssetUtilities.PRODUCT_CODE_L0_SKY_RESIDENTIAL;
  396. proot.ProductCode = AssetUtilities.PRODUCT_CODE_L0_SKY_RESIDENTIAL;
  397. proot.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  398. proot.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  399. insert proot;
  400.  
  401. Product2 prodTest2 = new Product2();
  402. prodTest2.name = AssetUtilities.PRODUCT_CODE_L0_SKY_RESIDENTIAL;
  403. prodTest2.ProductCode = AssetUtilities.PRODUCT_CODE_L2_TV_PACK;
  404. prodTest2.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  405. prodTest2.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  406. prodTest2.ProductCodeEX__c = 'ROOT';
  407. insert prodTest2;
  408.  
  409. Product2 prodTest3 = new Product2();
  410. prodTest3.name = AssetUtilities.PRODUCT_CODE_L4_CALCIO_DTT;
  411. prodTest3.ProductCode = AssetUtilities.PRODUCT_CODE_L4_CALCIO_DTT;
  412. prodTest3.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  413. prodTest3.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  414. insert prodTest3;
  415.  
  416. Product2 prodTest4 = new Product2();
  417. prodTest4.name = AssetUtilities.PRODUCT_CODE_L4_CALCIO_DTT;
  418. prodTest4.ProductCode = 'CHARGE_COSTITECNICI_DTT';
  419. prodTest4.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  420. prodTest4.Family = AssetUtilities.PRODUCT_FAMILY_VOUCHER;
  421. prodTest4.VoucherSize__c = '1';
  422. insert prodTest4;
  423.  
  424. Product2 prodTest5 = new Product2();
  425. prodTest5.name = AssetUtilities.PRODUCT_CODE_L2_TV_PACK;
  426. prodTest5.ProductCode = AssetUtilities.PRODUCT_CODE_L2_TV_PACK;
  427. prodTest5.vlocity_cmt__Status__c = AssetUtilities.ASSET_STATUS_ATTIVO;
  428. insert prodTest5;
  429.  
  430. Pricebook2 pricebookTest = [select id from Pricebook2 where isStandard=true];
  431.  
  432. pricebookEntry pbEntryTest = new pricebookEntry(UnitPrice = 0, Pricebook2Id = pricebookTest.id, Product2Id = prodTest2.id, UseStandardPrice = false);
  433. insert pbEntryTest;
  434.  
  435. pricebookEntry pbEntryTest2 = new pricebookEntry(UnitPrice = 0, Pricebook2Id = pricebookTest.id, Product2Id = prodTest4.id, UseStandardPrice = false);
  436. insert pbEntryTest2;
  437.  
  438. pricebookEntry pbEntryTest3 = new pricebookEntry(UnitPrice = 0, Pricebook2Id = pricebookTest.id, Product2Id = prodTest5.id, UseStandardPrice = false);
  439. insert pbEntryTest3;
  440.  
  441. Account accTest1 = new Account (Name='AccountTest3');
  442. insert accTest1;
  443.  
  444. Contract contrTest2 = new Contract(Name = 'ContrTest3', AccountId = accTest1.Id, flag_Tnb__c = true, Order_Number__c = '2100058', Billing_Id__c = accTest1.id, Status = 'FIRMATO', Causale_Cessazione__c = 'MULTIVISION');
  445. insert contrTest2;
  446. contrTest2.Status = 'ATTIVO';
  447. update contrTest2;
  448.  
  449. Contact contTest = new Contact(LastName = 'Contact Prova1', AccountId = accTest1.id, Phone = '3358954789', OtherPhone = '3335688569', MobilePhone = '3358954789', Codice_Fiscale__c = 'FRCTFF89E23G554E');
  450. insert contTest;
  451. accTest1.vlocity_cmt__PersonContactId__c = contTest.Id;
  452. update accTest1;
  453.  
  454. Order orderTest = new Order(Name = 'OrderTest', ContractId = contrTest2.Id, Status = 'Draft', Type ='CHANGE_CONSISTENCY',
  455. OG_OrderSubType__c = 'VOUCHER', EffectiveDate=date.Today(), Pricebook2Id = pricebookTest.id, accountid = accTest1.id);
  456. insert orderTest;
  457.  
  458. Order orderTest2 = new Order(Name = 'OrderTest3', ContractId = contrTest2.Id, Status = 'Draft', Type ='CHANGE_CONSISTENCY',
  459. OG_OrderSubType__c = 'VOUCHER', EffectiveDate=date.Today(), accountid = accTest1.id);
  460. insert orderTest2;
  461.  
  462.  
  463. Asset root = new Asset();
  464. root.Product2Id = proot.Id;
  465. root.vlocity_cmt__ContractId__c = contrTest2.id;
  466. root.AccountId = accTest1.Id;
  467. root.ContactId = contTest.Id;
  468. root.name = AssetUtilities.ASSET_L0_SKY_RESIDENTIAL;
  469. root.vlocity_cmt__LineNumber__c = '0001';
  470. root.status = AssetUtilities.ASSET_STATUS_ATTIVO;
  471. root.Quantity = 1;
  472. root.OG_StatoMatricola__c = AssetUtilities.ASSET_STATUS_DA_ATTIVARE;
  473. root.vlocity_cmt__ProvisioningStatus__c = AssetUtilities.ASSET_PROVISIONING_STATUS_ACTIVE;
  474. root.vlocity_cmt__RecurringTotal__c = 50;
  475. root.OG_EnablementNumber__c = '12346578654';
  476. insert root;
  477.  
  478. Asset tvPack = new Asset();
  479. tvPack.Product2Id = prodTest3.Id;
  480. tvPack.vlocity_cmt__ContractId__c = contrTest2.Id;
  481. tvPack.AccountId = accTest1.Id;
  482. tvPack.ContactId = contTest.Id;
  483. tvPack.name = AssetUtilities.ASSET_L2_TV_PACK;
  484. tvPack.vlocity_cmt__LineNumber = '0001.0001.0004';
  485. tvPack.status = AssetUtilities.ASSET_STATUS_ATTIVO;
  486. //tvPack.vlocity_cmt__JSONAttribute__c = '{"Cat_Attr_002":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDWAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Number","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Number","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x54AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDgAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Entitlement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Entitlement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x4zAAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"MV","id":2,"displayText":"MV"},{"value":"BASE","id":1,"displayText":"BASE"}],"default":[],"selectedItem":{"value":"BASE","id":1,"displayText":"BASE"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCsAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x50AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"-","id":1,"displayText":"-"},{"value":"SMC","id":2,"displayText":"SMC"}],"default":[],"selectedItem":{"value":"SMC","id":2,"displayText":"SMC"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCxAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Piattaforma_di_fruizione","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Piattaforma di fruizione","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x51AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"IPTV","id":2,"displayText":"IPTV"},{"value":"DTH","id":1,"displayText":"DTH"}],"default":[],"selectedItem":{"value":"IPTV","id":2,"displayText":"IPTV"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDCAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x52AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDlAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso_Tech","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso Tech","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x53AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null}],"Cat_Attr_001":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oE5AAI","attributecategoryid__c":"a3e260000000hWbAAI","categorycode__c":"Cat_Attr_001","categoryname__c":"Attributi Generici","attributeuniquecode__c":"Authocode","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Authocode","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x55AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":1,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null}]}';
  487. tvPack.vlocity_cmt__JSONAttribute__c = '{"Cat_Attr_002":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDWAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Number","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Number","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x54AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDgAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Entitlement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Entitlement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x4zAAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"MV","id":2,"displayText":"MV"},{"value":"BASE","id":1,"displayText":"BASE"}],"default":[],"selectedItem":{"value":"BASE","id":1,"displayText":"BASE"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCsAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Enablement_Type","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Enablement Type","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x50AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"-","id":1,"displayText":"-"},{"value":"SMC","id":2,"displayText":"SMC"}],"default":[],"selectedItem":{"value":"SMC","id":2,"displayText":"SMC"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oCxAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Piattaforma_di_fruizione","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Piattaforma di fruizione","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x51AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"IPTV","id":2,"displayText":"IPTV"},{"value":"DTH","id":1,"displayText":"DTH"}],"default":[],"selectedItem":{"value":"IPTV","id":2,"displayText":"IPTV"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDCAAY","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":false,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x52AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null},{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oDlAAI","attributecategoryid__c":"a3e260000000hWgAAI","categorycode__c":"Cat_Attr_002","categoryname__c":"Attributi TV Pack","attributeuniquecode__c":"Connesso_Tech","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Connesso Tech","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":true,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":false,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x53AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":"Dropdown","value__c":null,"valuedatatype__c":"Picklist","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":2,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Picklist","uiDisplayType":"Dropdown","values":[{"value":"NO","id":2,"displayText":"NO"},{"value":"SI","id":1,"displayText":"SI"}],"default":[],"selectedItem":{"value":"NO","id":2,"displayText":"NO"}},"$$AttributeDefinitionEnd$$":null}],"Cat_Attr_001":[{"$$AttributeDefinitionStart$$":null,"objectid__c":"01t26000002mXdiAAE","attributeid__c":"a3f260000004oE5AAI","attributecategoryid__c":"a3e260000000hWbAAI","categorycode__c":"Cat_Attr_001","categoryname__c":"Attributi Generici","attributeuniquecode__c":"Authocode","attributeconfigurable__c":true,"attributedisplaysequence__c":"1","attributefilterable__c":true,"isactive__c":true,"attributedisplayname__c":"Authocode","displaysequence__c":null,"formatmask__c":null,"hasrule__c":false,"isconfigurable__c":false,"ishidden__c":true,"valueinnumber__c":null,"objecttype__c":null,"querycode__c":null,"isreadonly__c":true,"isquerydriven__c":false,"querylabel__c":null,"id":"a3d260000005x55AAA","isrequired__c":false,"rulemessage__c":null,"uidisplaytype__c":null,"value__c":null,"valuedatatype__c":"Text","valuedescription__c":null,"attributecloneable__c":true,"categorydisplaysequence__c":1,"customconfiguitemplate__c":null,"attributeRunTimeInfo":{"dataType":"Text"},"$$AttributeDefinitionEnd$$":null}]}';
  488. tvPack.OG_ParentId__c = root.Id;
  489. tvPack.ParentId = root.Id;
  490. tvPack.vlocity_cmt__ContractId__c = contrTest2.id;
  491. tvPack.vlocity_cmt__ActivationDate__c = Date.Today();
  492. tvPack.Quantity = 1;
  493. tvPack.OG_EnablementNumber__c = '000404409096'; //serial code smart card
  494. tvPack.OG_XAssociazioneMatricolaDT__c = Date.Today();
  495. tvPack.OG_StatoMatricola__c = AssetUtilities.ASSET_STATUS_DA_ATTIVARE;
  496. tvPack.vlocity_cmt__ProvisioningStatus__c = AssetUtilities.ASSET_PROVISIONING_STATUS_ACTIVE;
  497. tvPack.vlocity_cmt__RecurringTotal__c = 50;
  498. insert tvPack;
  499.  
  500. Order o = [select id from order WHERE contract.order_number__c = '2100058' Limit 1];
  501. o.Pricebook2Id = pricebookTest.id;
  502. update o;
  503.  
  504. //asset and dependant entities creation
  505. Account accProva = new Account (Name='AccountTest99');
  506. insert accProva;
  507.  
  508. Contract contrProva = new Contract(Name = 'ContrTest99', AccountId = accProva.Id, flag_Tnb__c = true, Order_Number__c = '21000573', Billing_Id__c = accProva.id, Status = 'FIRMATO', Causale_Cessazione__c = 'MULTIVISION');
  509. insert contrProva;
  510. contrProva.Status = 'COMPLETO';
  511. update contrProva;
  512.  
  513. Asset[] assetList = new List<Asset>();
  514. for(integer i =0; i<15; i++) {
  515. assetList.add(new Asset(vlocity_cmt__ContractId__c= contrTest2.Id, name = 'SKY RESIDENTIAL COMMERCIAL OFFER', AccountId = accProva.Id));
  516. }
  517. Asset newAsset = new Asset(vlocity_cmt__ContractId__c = contrProva.Id, name = 'ASSET DAZN',
  518. AccountId = accProva.Id, vlocity_cmt__provisioningstatus__c = AssetUtilities.ASSET_PROVISIONING_STATUS_ACTIVE);
  519. Asset smcAsset = new Asset(vlocity_cmt__ContractId__c = contrProva.Id, name = 'TEST ASSET', AccountId = accProva.Id, OG_EnablementNumber__c = '123123123');
  520. insert assetList;
  521. insert newAsset;
  522. insert smcAsset;
  523.  
  524. OrderItem orderItTest = new OrderItem(OrderId = orderTest.id, vlocity_cmt__AssetId__c = assetList[0].id, PricebookEntryId = pbEntryTest.id, Quantity = 1, UnitPrice = 0, Product2Id = prodTest2.id);
  525. insert orderItTest;
  526.  
  527. OrderItem orderItTest2 = new OrderItem(OrderId = o.id, vlocity_cmt__AssetId__c = assetList[0].id, PricebookEntryId = pbEntryTest2.id, Quantity = 1, UnitPrice = 0, Product2Id = prodTest4.id);
  528. insert orderItTest2;
  529.  
  530. OrderItem orderItTest3 = new OrderItem(OrderId = o.id, PricebookEntryId = pbEntryTest3.id, Quantity = 1, UnitPrice = 0, Product2Id = prodTest5.id);
  531. insert orderItTest3;
  532.  
  533. Template_Stampa__c template = new Template_Stampa__c(Name = 'Template_Stampa', DS_View_Url__c ='http://siebelcoll.prj.skytv.it/ecommunications_ita/pdf',DS_view_location__c='addendum');
  534. insert template;
  535.  
  536. Folder folder = [select id from Folder where Name = 'Public Folder'];
  537.  
  538. Case cs = new Case(AccountId = accTest1.id, ContactId = contTest.Id);
  539. insert cs;
  540.  
  541. Case csWithParent = new Case(AccountId = accTest1.id, ContactId = contTest.Id, ParentId = cs.Id);
  542. insert csWithParent;
  543.  
  544. //caso OK
  545. /*method= 'checkProfileUser';
  546. User usr1 = [Select id from User where Id = :UserInfo.getUserId()];
  547. input.put('userId',usr1.id);
  548. test = controller.invokeImplementationMethod(method, input, output, options);
  549. input.clear();
  550.  
  551. //Caso Exception
  552. method= 'checkProfileUser';
  553. test = controller.invokeImplementationMethod(method, input, output, options);
  554.  
  555. method= 'preliminaryCheck';
  556. input.put('isRetail',true);
  557. input.put('ContractId',contrTest.id);
  558. input.put('AccountId', accTest.Id);
  559. input.put('ContactId', contTest.Id);
  560. test = controller.invokeImplementationMethod(method, input, output, options);
  561. input.clear();
  562.  
  563. //Caso Exception
  564.  
  565. method= 'updateContractListino';
  566.  
  567.  
  568. test = controller.invokeImplementationMethod(method, input, output, options);
  569.  
  570. //Caso OK
  571. method= 'updateContractListino';
  572. input.put('ContractId',contrTest.id);
  573.  
  574. test = controller.invokeImplementationMethod(method, input, output, options);
  575.  
  576. //Caso Exception
  577. method= 'saveOrder';
  578. test = controller.invokeImplementationMethod(method, input, output, options);
  579.  
  580. //Caso OK
  581. method= 'saveOrder';
  582. input.put('fdoId',o.id);
  583. input.put('ContractId', contrTest.Id);
  584. input.put('priceListAPPCode_name','Listino_SKY_App_DTT');
  585. input.put('ActivityCode','SKY8021');
  586. /*Set<String> costCodeSet = SkyCO_Utilities.retrieveConstantsValus( SkyCO_Utilities.costProductCode );
  587. system.debug('FV saveORder costCodeSet: '+costCodeSet);*/
  588.  
  589. /*List<OrderItem> clsOrderItemList = [SELECT Id,Product2.ProductCode FROM OrderItem WHERE OrderId =: o.id AND Product2.ProductCode IN: costCodeSet ];
  590. system.debug('FV saveORder test: '+clsOrderItemList.get(0).Product2.ProductCode);
  591. test = controller.invokeImplementationMethod(method, input, output, options);*/
  592.  
  593. //Caso EXCEPTION
  594. method= 'getAccountInfo';
  595. test = controller.invokeImplementationMethod(method, input, output, options);
  596.  
  597. //Caso OK
  598. method= 'getAccountInfo';
  599. input.put('AccountId', accTest1.Id);
  600. test = controller.invokeImplementationMethod(method, input, output, options);
  601.  
  602. method= 'getCustomerContracts';
  603. input.put('customerCodiceFiscale','FRCTFF89E23G554E');
  604. input.put('customerCodiceContratto','2100058');
  605. test = controller.invokeImplementationMethod(method, input, output, options);
  606.  
  607. method= 'getCustomerContracts';
  608. input.put('customerCodiceFiscale','FRCTFF89E23G554E');
  609. input.put('customerCodiceContratto','');
  610.  
  611. //FRICCIULLI
  612. Account accTest1a = new Account (Name='AccountTest4');
  613. insert accTest1a;
  614.  
  615. String parentId = Schema.SObjectType.Contract.getRecordTypeInfosByName().get('Contract').getRecordTypeId();
  616. Contract contrTest2a = new Contract(Name = 'ContrTest4', RecordTypeId = parentId, AccountId = accTest1a.Id, flag_Tnb__c = true, Order_Number__c = '2100059', Billing_Id__c = accTest1a.id, Status = 'FIRMATO', Causale_Cessazione__c = 'MULTIVISION');
  617. insert contrTest2a;
  618. contrTest2a.Status = 'ATTIVO';
  619. update contrTest2a;
  620.  
  621. Contact contTesta = new Contact(LastName = 'Contact Prova2', AccountId = accTest1a.id, Phone = '3358954789', OtherPhone = '3335688569', MobilePhone = '3358954789', Codice_Fiscale__c = 'FRCTFF89E23G554E');
  622. insert contTesta;
  623. accTest1a.vlocity_cmt__PersonContactId__c = contTesta.Id;
  624. update accTest1a;
  625.  
  626. test = controller.invokeImplementationMethod(method, input, output, options);
  627.  
  628. //CASO OK
  629. Map<String,Object> selections = new Map<String,Object>();
  630. method= 'getVoucher';
  631. selections.put('customerOtherPhoneSelection',true);
  632. selections.put('customerOtherPhone','3335688745');
  633. input.put('CHECKUSERDETAILS_at',selections);
  634. input.put('isRetail',true);
  635. input.put('ContractId',contrTest2.id);
  636. input.put('AccountId', accTest1.Id);
  637. input.put('ContactId', contTest.Id);
  638. test = controller.invokeImplementationMethod(method, input, output, options);
  639. input.clear();
  640.  
  641. //Caso EXCEPTION
  642. method= 'getVoucher';
  643. selections.put('customerOtherPhoneSelection',true);
  644. selections.put('customerOtherPhone','3335688745');
  645. input.put('CHECKUSERDETAILS_at',selections);
  646. input.put('isRetail',true);
  647. test = controller.invokeImplementationMethod(method, input, output, options);
  648.  
  649. method= 'sendOrder';
  650. input.put('fdoId',o.id);
  651. input.put('ContractId',contrTest2.id);
  652. input.put('ParentCaseId',cs.id);
  653. input.put('CaseId',csWithParent.id);
  654. input.put('codiceVenditore1','123456');
  655. input.put('codiceVenditore2','123456');
  656. test = controller.invokeImplementationMethod(method, input, output, options);
  657.  
  658.  
  659.  
  660.  
  661. method= 'printAddendum';
  662. test = controller.invokeImplementationMethod(method, input, output, options);
  663. NewCrm_RetailSupportClass.ws_outputRetail ws_output_test = new NewCrm_RetailSupportClass.ws_outputRetail();
  664. ws_output_test.Esito='OK';
  665. ws_output_test.FileNamePDF='8A7F059BCDF0DCC14558.pdf';
  666. ws_output_test.Tid='C0A8A7F059BCDF0DCC145589';
  667. SkyPartnerAPP.ws_outputTestClass = ws_output_test;
  668. input.put('ContractId',contrTest2.id);
  669. input.put('ContactId', contTest.Id);
  670. input.put('CaseId',cs.id);
  671. input.put('fdoId',o.id);
  672.  
  673. test = controller.invokeImplementationMethod(method, input, output, options);
  674. document docTemp = new Document(Name = 'Template4', FolderId = folder.id);
  675. insert docTemp;
  676. ws_output_test.Esito='KO';
  677. SkyPartnerAPP.ws_outputTestClass = ws_output_test;
  678. test = controller.invokeImplementationMethod(method, input, output, options);
  679.  
  680. input.clear();
  681. method= 'getEnrollVoucherExtra';
  682. input.put('fdoId',o.Id);
  683. input.put('ContractId',contrTest2.id);
  684. test = controller.invokeImplementationMethod(method, input, output, options);
  685. input.clear();
  686. selections.clear();
  687.  
  688. method= 'enrollVoucherExtra_callBack';
  689. selections.put('wrapper','Test');
  690. input.put('vlcContinuationCallbackState',selections);
  691. options.put('vlcContinuationCallbackLabels',ps);
  692. test = controller.invokeImplementationMethod(method, input, output, options);
  693. input.clear();
  694.  
  695. method = 'getCartsPromotionsApex';
  696. test = controller.invokeImplementationMethod(method, input, output, options);
  697. input.put('cartId',o.id);
  698. method = 'getCartsPromotionsApex';
  699. test = controller.invokeImplementationMethod(method, input, output, options);
  700.  
  701. List<String> promotionRecords = new List<String>();
  702. promotionRecords.add('Test');
  703. Map<String, Object> toPut = new Map<String, Object>();
  704. toPut.put('records',promotionRecords);
  705.  
  706. method = 'checkListPromotion';
  707. test = controller.invokeImplementationMethod(method, input, output, options);
  708. input.put('PromotionsList',toPut);
  709. method = 'checkListPromotion';
  710. test = controller.invokeImplementationMethod(method, input, output, options);
  711.  
  712. System.Test.startTest();
  713. controller.calculatePriceForCPQ(o.id);
  714.  
  715. try{
  716.  
  717. controller.updateContractListino(input, output, options);
  718. }catch (Exception e){}
  719.  
  720. System.Test.stopTest();
  721.  
  722.  
  723. }
  724.  
  725. private static void freeMaps(){
  726. input = new Map<String, Object>();
  727. output = new Map<String, Object>();
  728. options = new Map<String, Object>();
  729. }
  730.  
  731. @isTest
  732. static void testSiebelOrderValidation_callBack(){
  733. String nameMethod = 'siebelOrderValidation_callBack';
  734. freeMaps();
  735. Test.startTest();
  736. SkyPartnerAPP testObj = new SkyPartnerAPP();
  737. //Test OK
  738. WS_SiebelOrderValidationData.responseValidateOrderType response = new WS_SiebelOrderValidationData.responseValidateOrderType();
  739. response.esito = '0';
  740. response.resultValidateOrder = new WS_SiebelOrderValidationData.resultValidateOrderType();
  741. response.resultValidateOrder.result = 'OK';
  742. response.resultValidateOrder.description = 'Esito Positivo';
  743. input.put('responseSiebelOrderValidation', response);
  744. System.assertEquals(nameMethod, testObj.invokeImplementationMethod(nameMethod,input,output,options));
  745. System.assertEquals('OK', output.get('resultOrderValidation'));
  746. System.assertEquals('Esito Positivo', output.get('descriptionOrderValidation'));
  747. //Test KO with description
  748. freeMaps();
  749. response = new WS_SiebelOrderValidationData.responseValidateOrderType();
  750. response.esito = '1';
  751. response.DescrizioneEsito = 'errore 1';
  752. input.put('responseSiebelOrderValidation', response);
  753. System.assertEquals(nameMethod, testObj.invokeImplementationMethod(nameMethod,input,output,options));
  754. System.assertEquals('errore 1', output.get('siebelOrderValErrorMsg'));
  755. //Test KO no description
  756. freeMaps();
  757. response = new WS_SiebelOrderValidationData.responseValidateOrderType();
  758. response.esito = '1';
  759. input.put('responseSiebelOrderValidation', response);
  760. System.assertEquals(nameMethod, testObj.invokeImplementationMethod(nameMethod,input,output,options));
  761. System.assertEquals('Errore retrieveOds', output.get('siebelOrderValErrorMsg'));
  762.  
  763. nameMethod = 'siebelOrderValidationVoucher_callBack';
  764. testObj.invokeImplementationMethod(nameMethod, input, output, options);
  765.  
  766. PartnerAppUtilities.getVouchertList(input);
  767.  
  768. Test.stopTest();
  769. }
  770. }
RAW Paste Data