PageRenderTime 57ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/classes/TenantAutomationRequestHelperTest.cls

https://bitbucket.org/jordanblum16/sfdc
Visual Basic for Applications | 1239 lines | 1046 code | 193 blank | 0 comment | 17 complexity | 2193de3deddb0e1494a3f83c42fb5d2d MD5 | raw file
  1. @isTest
  2. private class TenantAutomationRequestHelperTest {
  3. static Account acc;
  4. static Contact cntct;
  5. static Account partnerAccount;
  6. static Contact partnerContact;
  7. static Deployments__c deployment;
  8. static Customer_Tenant_Prefix__c testPrefix;
  9. static Deployment_Contact__c depContact ;
  10. static WTA_Customer_Tenant__c provisionedtenant;
  11. static WTA_Customer_Tenant__c activetenant;
  12. static User u,testCustomerUser ;
  13. static {
  14. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  15. for(Data_Migration__c dm : dmlist ){
  16. dm.Exclude_Triggers__c = true;
  17. }
  18. update dmlist;
  19. acc = TEST_DB_Core.getAccount('Customer');
  20. cntct = TEST_DB_Core.getContact(acc, 'Prospect/Customer Contact');
  21. testCustomerUser = Test_DB_Core.getNewUser('Workday - Customer Portal Profile', 'CustomerPortal');
  22. List<User> testUsers = [Select Id, contactid, accountid, username from user where isactive=true and contactid!=null and accountid!=null and id=:testCustomerUser.Id limit 1];
  23. cntct = new Contact(id = testUsers[0].ContactId);
  24. cntct.Contact_Status__c = 'Active';
  25. update cntct;
  26. partnerAccount = TEST_DB_Core.getAccount('Partner');
  27. partnerAccount.Type='Partner';
  28. partnerAccount.Name='ABC';
  29. partnerContact = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  30. partnerContact.Contact_Status__c='Active';
  31. //partnerContact.Contact_Type__c='Partner';
  32. partnerContact.Primary_Main_Contact__c=true;
  33. update partnerContact;
  34. u = TEST_DB_Core.getNewUser(partnerContact, 'Gold Workday Partner Profile', 'PartnerPortal');
  35. partnerAccount.Account_Status__c='Active';
  36. update partnerAccount;
  37. deployment = new Deployments__c();
  38. deployment.Customer__c = acc.Id;
  39. deployment.Priming_Partner__c=partnerAccount.Id;
  40. deployment.Overall_Status__c='Active';
  41. deployment.Deployment_Type__c='Post Go Live';
  42. insert deployment;
  43. depContact = new Deployment_Contact__c();
  44. depContact.Deployment__c = deployment.Id;
  45. depContact.Contact__c = partnerContact.Id;
  46. depContact.Contact_Type__c='Partner';
  47. depContact.Contact_Role__c='Principal Consultant';
  48. depContact.Authorized_for_Tenant_Changes__c='YES';
  49. depContact.Contact_State__c='Active';
  50. depContact.WTA_Email_Notification__c=true;
  51. insert depContact;
  52. WTA_Tenant_Type__c wtaTenty = new WTA_Tenant_Type__c();
  53. wtaTenty.name= 'Implementation Preview';
  54. wtaTenty.Active__c=True;
  55. wtaTenty.Code__c='IMPL';
  56. wtaTenty.Sort_Order__c=5;
  57. insert wtaTenty;
  58. WTA_Tenant_Type__c wtaTenty2 = new WTA_Tenant_Type__c();
  59. wtaTenty2.name= 'Implementation Preview';
  60. wtaTenty2.Active__c=True;
  61. wtaTenty2.Code__c='PROD';
  62. wtaTenty2.Sort_Order__c=5;
  63. insert wtaTenty2;
  64. WTA_Tenant_Type__c wtaTenty3 = new WTA_Tenant_Type__c();
  65. wtaTenty3.name= 'Implementation Preview';
  66. wtaTenty3.Active__c=True;
  67. wtaTenty3.Code__c='SANDBOX';
  68. wtaTenty3.Sort_Order__c=5;
  69. insert wtaTenty3;
  70. WTA_Data_Center__c dc = new WTA_Data_Center__c();
  71. dc.Name='Atlanta';
  72. dc.Data_Center_Code__c='DUB';
  73. insert dc;
  74. /*
  75. Customer_Release_Wave__c relWave = new Customer_Release_Wave__c();
  76. relWave.Account__c = acc.id;
  77. relWave.Release__c = '300';
  78. relWave.Waves__c = 'Wave 0';
  79. insert relWave; */
  80. }
  81. static testMethod void myUnitTest() {
  82. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  83. for(Data_Migration__c dm : dmlist ){
  84. dm.Exclude_Triggers__c = true;
  85. }
  86. update dmlist;
  87. WTACustomerTenantTriggerHelper.skipTrigger = true;
  88. test.startTest();
  89. Case cse = new Case();
  90. cse.AccountId = acc.Id;
  91. cse.contactId = cntct.id;
  92. cse.Case_Type__c = 'Customer Care Request';//sumant
  93. insert cse;
  94. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  95. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  96. Tenant_Automation_Request__c req = new Tenant_Automation_Request__c();
  97. req.Tenant_Management_Area__c=WTA_Helper.SFTP_CREATE_SITE;
  98. req.Destination_Tenant__c=provisionedtenant.Id;
  99. req.Status__c='Submitted';
  100. req.Due_Date__c= Date.newInstance(2020, 1, 1);
  101. req.Customer__c = acc.Id;
  102. req.Request_Number__c='TAR-898988';
  103. req.Origin__c='Customer Portal';
  104. req.End_Point__c =null;
  105. req.User_Name__c =null;
  106. insert req;
  107. req.End_Point__c = 'sftp-impl.workday.com';
  108. req.sFTP_Site_Name__c = 'discover-HCM';
  109. req.User_Name__c ='redrobin2';
  110. req.Status__c = 'Cancelled';
  111. req.Tenant_Management_Area__c = 'SFTP – Create Site';
  112. update req;
  113. Tenant_Automation_Request_Team__c team = new Tenant_Automation_Request_Team__c();
  114. team.Tenant_Automation_Request__c=req.Id;
  115. team.User__c = u.Id;
  116. insert team;
  117. req.Due_Date__c= Date.newInstance(2020, 2, 1);
  118. req.status__c='Complete';
  119. update req;
  120. req.status__c='Cancelled';
  121. update req;
  122. test.stopTest();
  123. }
  124. static testmethod void NewUnitTest8() {
  125. //line 438
  126. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  127. for(Data_Migration__c dm : dmlist ){
  128. dm.Exclude_Triggers__c = true;
  129. }
  130. update dmlist;
  131. WTACustomerTenantTriggerHelper.skipTrigger = true;
  132. test.startTest();
  133. Case cse = new Case();
  134. cse.AccountId = acc.Id;
  135. cse.contactId = cntct.id;
  136. cse.Case_Type__c = 'Customer Care Request';//sumant
  137. insert cse;
  138. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  139. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  140. //****Create User******
  141. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  142. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  143. string username = 'user1@workdayinc.com.testcoverage';
  144. User u2 = new User(
  145. Username = username,
  146. Email = username,
  147. Alias = 'Atester',
  148. LastName = 'user1Nametester',
  149. EmailEncodingKey = 'UTF-8',
  150. LanguageLocaleKey = 'en_US',
  151. LocaleSidKey = 'en_US',
  152. TimeZoneSidKey = 'GMT',
  153. ProfileId = p.Id
  154. );
  155. //u2.ContactId=partnerContact2.Id;
  156. insert u2;
  157. system.debug('==u2==' + u2);
  158. //****Create User******
  159. system.runAs(u2)
  160. {
  161. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  162. req2.Tenant_Management_Area__c=wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  163. req2.Destination_Tenant__c=provisionedtenant.Id;
  164. req2.Status__c='Submitted';
  165. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  166. req2.Customer__c = acc.Id;
  167. req2.request_Number__c='TAR-898989';
  168. req2.Origin__c='Customer Portal';
  169. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  170. req2.User_Name__c ='redrobin3';
  171. insert req2;
  172. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  173. // user u2 = [select id,email from user where id =: req2.CreatedById];
  174. // u2.email = 'test22@test22.com';
  175. // update u2;
  176. Tenant_Automation_Request_Team__c team;
  177. team = new Tenant_Automation_Request_Team__c();
  178. team.Tenant_Automation_Request__c=req2.Id;
  179. team.User__c = u2.id;
  180. insert team;
  181. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  182. system.debug('==team==' + team + '==id==' + team.id);
  183. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  184. req2.sFTP_Site_Name__c = 'discover-HCM';
  185. req2.User_Name__c ='redrobin4';
  186. req2.Status__c = 'Completed';
  187. req2.Tenant_Management_Area__c = wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  188. update req2;
  189. }
  190. test.stopTest();
  191. }
  192. static testmethod void NewUnitTest9() {
  193. //line 452
  194. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  195. for(Data_Migration__c dm : dmlist ){
  196. dm.Exclude_Triggers__c = true;
  197. }
  198. update dmlist;
  199. WTACustomerTenantTriggerHelper.skipTrigger = true;
  200. test.startTest();
  201. Case cse = new Case();
  202. cse.AccountId = acc.Id;
  203. cse.contactId = cntct.id;
  204. cse.Case_Type__c = 'Customer Care Request'; //sumanth
  205. insert cse;
  206. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  207. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  208. //****Create User******
  209. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  210. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  211. string username = 'user1@workdayinc.com.testcoverage';
  212. User u2 = new User(
  213. Username = username,
  214. Email = username,
  215. Alias = 'Atester',
  216. LastName = 'user1Nametester',
  217. EmailEncodingKey = 'UTF-8',
  218. LanguageLocaleKey = 'en_US',
  219. LocaleSidKey = 'en_US',
  220. TimeZoneSidKey = 'GMT',
  221. ProfileId = p.Id
  222. );
  223. //u2.ContactId=partnerContact2.Id;
  224. insert u2;
  225. system.debug('==u2==' + u2);
  226. //****Create User******
  227. system.runAs(u2)
  228. {
  229. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  230. req2.Tenant_Management_Area__c=wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  231. req2.Destination_Tenant__c=provisionedtenant.Id;
  232. req2.Status__c='Submitted';
  233. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  234. req2.Customer__c = acc.Id;
  235. req2.request_Number__c='TAR-898989';
  236. req2.Origin__c='Customer Portal';
  237. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  238. req2.User_Name__c ='redrobin3';
  239. insert req2;
  240. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  241. // user u2 = [select id,email from user where id =: req2.CreatedById];
  242. // u2.email = 'test22@test22.com';
  243. // update u2;
  244. Tenant_Automation_Request_Team__c team;
  245. team = new Tenant_Automation_Request_Team__c();
  246. team.Tenant_Automation_Request__c=req2.Id;
  247. team.User__c = u2.id;
  248. insert team;
  249. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  250. system.debug('==team==' + team + '==id==' + team.id);
  251. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  252. req2.sFTP_Site_Name__c = 'discover-HCM';
  253. req2.User_Name__c ='redrobin4';
  254. req2.Status__c = 'Completed';
  255. req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  256. update req2;
  257. }
  258. test.stopTest();
  259. }
  260. static testmethod void SandboxPreviewRefrshExemption() {
  261. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  262. for(Data_Migration__c dm : dmlist ){
  263. dm.Exclude_Triggers__c = true;
  264. }
  265. update dmlist;
  266. WTACustomerTenantTriggerHelper.skipTrigger = true;
  267. test.startTest();
  268. Case cse = new Case();
  269. cse.AccountId = acc.Id;
  270. cse.contactId = cntct.id;
  271. cse.Case_Type__c = 'Customer Care Request';//sumanth
  272. insert cse;
  273. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  274. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  275. //****Create User******
  276. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  277. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  278. string username = 'user1@workdayinc.com.testcoverage';
  279. User u2 = new User(
  280. Username = username,
  281. Email = username,
  282. Alias = 'Atester',
  283. LastName = 'user1Nametester',
  284. EmailEncodingKey = 'UTF-8',
  285. LanguageLocaleKey = 'en_US',
  286. LocaleSidKey = 'en_US',
  287. TimeZoneSidKey = 'GMT',
  288. ProfileId = p.Id
  289. );
  290. //u2.ContactId=partnerContact2.Id;
  291. insert u2;
  292. system.debug('==u2==' + u2);
  293. //****Create User******
  294. system.runAs(u2)
  295. {
  296. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  297. req2.Tenant_Management_Area__c=wta_helper.SANDBOX_PREVIEW_REFRESH_EXEMPTION;
  298. req2.Destination_Tenant__c=provisionedtenant.Id;
  299. req2.Status__c='Submitted';
  300. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  301. req2.Customer__c = acc.Id;
  302. req2.request_Number__c='TAR-898999';
  303. req2.Origin__c='Customer Portal';
  304. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  305. req2.User_Name__c ='redrobin3';
  306. insert req2;
  307. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  308. // user u2 = [select id,email from user where id =: req2.CreatedById];
  309. // u2.email = 'test22@test22.com';
  310. // update u2;
  311. Tenant_Automation_Request_Team__c team,team1;
  312. team = new Tenant_Automation_Request_Team__c();
  313. team.Tenant_Automation_Request__c=req2.Id;
  314. team.User__c = u2.id;
  315. insert team;
  316. team1 = new Tenant_Automation_Request_Team__c();
  317. team1.Tenant_Automation_Request__c=req2.Id;
  318. team1.User__c = testCustomerUser.id;
  319. insert team1;
  320. List<Tenant_Automation_Request_Team__c> teamList =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  321. //system.debug('==team==' + teamList.size + '==id==' + teamList);
  322. req2.Status__c = 'Completed';
  323. // req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  324. update req2;
  325. req2.status__c='Cancelled';
  326. update req2;
  327. }
  328. test.stopTest();
  329. }
  330. static testmethod void SandboxPreviewRefresh() {
  331. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  332. for(Data_Migration__c dm : dmlist ){
  333. dm.Exclude_Triggers__c = true;
  334. }
  335. update dmlist;
  336. WTACustomerTenantTriggerHelper.skipTrigger = true;
  337. test.startTest();
  338. Case cse = new Case();
  339. cse.AccountId = acc.Id;
  340. cse.contactId = cntct.id;
  341. cse.Case_Type__c = 'Customer Care Request';//sumanth
  342. insert cse;
  343. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  344. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  345. //****Create User******
  346. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  347. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  348. string username = 'user1@workdayinc.com.testcoverage';
  349. User u2 = new User(
  350. Username = username,
  351. Email = username,
  352. Alias = 'Atester',
  353. LastName = 'user1Nametester',
  354. EmailEncodingKey = 'UTF-8',
  355. LanguageLocaleKey = 'en_US',
  356. LocaleSidKey = 'en_US',
  357. TimeZoneSidKey = 'GMT',
  358. ProfileId = p.Id
  359. );
  360. //u2.ContactId=partnerContact2.Id;
  361. insert u2;
  362. system.debug('==u2==' + u2);
  363. //****Create User******
  364. system.runAs(u2)
  365. {
  366. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  367. req2.Tenant_Management_Area__c=wta_helper.SANDBOX_PREVIEW_REFRESH;
  368. req2.Destination_Tenant__c=provisionedtenant.Id;
  369. req2.Status__c='Submitted';
  370. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  371. req2.Customer__c = acc.Id;
  372. req2.request_Number__c='TAR-898999';
  373. req2.Origin__c='Customer Portal';
  374. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  375. req2.User_Name__c ='redrobin3';
  376. insert req2;
  377. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  378. // user u2 = [select id,email from user where id =: req2.CreatedById];
  379. // u2.email = 'test22@test22.com';
  380. // update u2;
  381. Tenant_Automation_Request_Team__c team,team1;
  382. team = new Tenant_Automation_Request_Team__c();
  383. team.Tenant_Automation_Request__c=req2.Id;
  384. team.User__c = u2.id;
  385. insert team;
  386. team1 = new Tenant_Automation_Request_Team__c();
  387. team1.Tenant_Automation_Request__c=req2.Id;
  388. team1.User__c = testCustomerUser.id;
  389. insert team1;
  390. List<Tenant_Automation_Request_Team__c> teamList =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  391. //system.debug('==team==' + teamList.size + '==id==' + teamList);
  392. req2.Status__c = 'Completed';
  393. // req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  394. update req2;
  395. req2.status__c='Cancelled';
  396. update req2;
  397. }
  398. test.stopTest();
  399. }
  400. static testmethod void tenant_operations() {
  401. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  402. for(Data_Migration__c dm : dmlist ){
  403. dm.Exclude_Triggers__c = true;
  404. }
  405. update dmlist;
  406. WTACustomerTenantTriggerHelper.skipTrigger = true;
  407. test.startTest();
  408. Case cse = new Case();
  409. cse.AccountId = acc.Id;
  410. cse.contactId = cntct.id;
  411. cse.Case_Type__c = 'Customer Care Request';//sumanth
  412. insert cse;
  413. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  414. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  415. //****Create User******
  416. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  417. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  418. string username = 'user1@workdayinc.com.testcoverage';
  419. User u2 = new User(
  420. Username = username,
  421. Email = username,
  422. Alias = 'Atester',
  423. LastName = 'user1Nametester',
  424. EmailEncodingKey = 'UTF-8',
  425. LanguageLocaleKey = 'en_US',
  426. LocaleSidKey = 'en_US',
  427. TimeZoneSidKey = 'GMT',
  428. ProfileId = p.Id
  429. );
  430. //u2.ContactId=partnerContact2.Id;
  431. insert u2;
  432. system.debug('==u2==' + u2);
  433. //****Create User******
  434. system.runAs(u2)
  435. {
  436. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  437. req2.Tenant_Management_Area__c=wta_helper.TENANT_OPERATIONS;
  438. req2.Destination_Tenant__c=provisionedtenant.Id;
  439. req2.Status__c='Submitted';
  440. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  441. req2.Customer__c = acc.Id;
  442. req2.request_Number__c='TAR-898999';
  443. req2.Origin__c='Customer Portal';
  444. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  445. req2.User_Name__c ='redrobin3';
  446. req2.ADP_TAR__c = false;
  447. req2.Tenant_Action__c = 'Tenant Rename';
  448. req2.Destination_Tenant_Type__c = 'Implementation';
  449. insert req2;
  450. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  451. // user u2 = [select id,email from user where id =: req2.CreatedById];
  452. // u2.email = 'test22@test22.com';
  453. // update u2;
  454. Tenant_Automation_Request_Team__c team,team1;
  455. team = new Tenant_Automation_Request_Team__c();
  456. team.Tenant_Automation_Request__c=req2.Id;
  457. team.User__c = u2.id;
  458. insert team;
  459. team1 = new Tenant_Automation_Request_Team__c();
  460. team1.Tenant_Automation_Request__c=req2.Id;
  461. team1.User__c = testCustomerUser.id;
  462. insert team1;
  463. List<Tenant_Automation_Request_Team__c> teamList =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  464. //system.debug('==team==' + teamList.size + '==id==' + teamList);
  465. req2.Status__c = 'Completed';
  466. // req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  467. update req2;
  468. req2.status__c='Cancelled';
  469. update req2;
  470. }
  471. test.stopTest();
  472. }
  473. static testmethod void NewUnitTest10() {
  474. //line 462
  475. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  476. for(Data_Migration__c dm : dmlist ){
  477. dm.Exclude_Triggers__c = true;
  478. }
  479. update dmlist;
  480. WTACustomerTenantTriggerHelper.skipTrigger = true;
  481. test.startTest();
  482. Case cse = new Case();
  483. cse.AccountId = acc.Id;
  484. cse.contactId = cntct.id;
  485. cse.Case_Type__c = 'Customer Care Request';//sumanth
  486. insert cse;
  487. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  488. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  489. //****Create User******
  490. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  491. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  492. string username = 'user1@workdayinc.com.testcoverage';
  493. User u2 = new User(
  494. Username = username,
  495. Email = username,
  496. Alias = 'Atester',
  497. LastName = 'user1Nametester',
  498. EmailEncodingKey = 'UTF-8',
  499. LanguageLocaleKey = 'en_US',
  500. LocaleSidKey = 'en_US',
  501. TimeZoneSidKey = 'GMT',
  502. ProfileId = p.Id
  503. );
  504. //u2.ContactId=partnerContact2.Id;
  505. insert u2;
  506. system.debug('==u2==' + u2);
  507. //****Create User******
  508. system.runAs(u2)
  509. {
  510. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  511. req2.Tenant_Management_Area__c=wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  512. req2.Destination_Tenant__c=provisionedtenant.Id;
  513. req2.Status__c='Submitted';
  514. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  515. req2.Customer__c = acc.Id;
  516. req2.request_Number__c='TAR-898989';
  517. req2.Origin__c='Customer Portal';
  518. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  519. req2.User_Name__c ='redrobin3';
  520. insert req2;
  521. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  522. // user u2 = [select id,email from user where id =: req2.CreatedById];
  523. // u2.email = 'test22@test22.com';
  524. // update u2;
  525. Tenant_Automation_Request_Team__c team;
  526. team = new Tenant_Automation_Request_Team__c();
  527. team.Tenant_Automation_Request__c=req2.Id;
  528. team.User__c = u2.id;
  529. insert team;
  530. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  531. system.debug('==team==' + team + '==id==' + team.id);
  532. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  533. req2.sFTP_Site_Name__c = 'discover-HCM';
  534. req2.User_Name__c ='redrobin4';
  535. req2.Status__c = 'Cancelled';
  536. req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  537. update req2;
  538. }
  539. test.stopTest();
  540. }
  541. static testmethod void NewUnitTest11() {
  542. //line 473
  543. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  544. for(Data_Migration__c dm : dmlist ){
  545. dm.Exclude_Triggers__c = true;
  546. }
  547. update dmlist;
  548. WTACustomerTenantTriggerHelper.skipTrigger = true;
  549. test.startTest();
  550. Case cse = new Case();
  551. cse.AccountId = acc.Id;
  552. cse.contactId = cntct.id;
  553. cse.Case_Type__c = 'Customer Care Request';//sumant
  554. insert cse;
  555. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  556. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  557. //****Create User******
  558. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  559. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  560. string username = 'user1@workdayinc.com.testcoverage';
  561. User u2 = new User(
  562. Username = username,
  563. Email = username,
  564. Alias = 'Atester',
  565. LastName = 'user1Nametester',
  566. EmailEncodingKey = 'UTF-8',
  567. LanguageLocaleKey = 'en_US',
  568. LocaleSidKey = 'en_US',
  569. TimeZoneSidKey = 'GMT',
  570. ProfileId = p.Id
  571. );
  572. //u2.ContactId=partnerContact2.Id;
  573. insert u2;
  574. system.debug('==u2==' + u2);
  575. //****Create User******
  576. system.runAs(u2)
  577. {
  578. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  579. req2.Tenant_Management_Area__c=wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  580. req2.Destination_Tenant__c=provisionedtenant.Id;
  581. req2.Status__c='Submitted';
  582. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  583. req2.Customer__c = acc.Id;
  584. req2.request_Number__c='TAR-898989';
  585. req2.Origin__c='Customer Portal';
  586. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  587. req2.User_Name__c ='redrobin3';
  588. insert req2;
  589. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  590. // user u2 = [select id,email from user where id =: req2.CreatedById];
  591. // u2.email = 'test22@test22.com';
  592. // update u2;
  593. Tenant_Automation_Request_Team__c team;
  594. team = new Tenant_Automation_Request_Team__c();
  595. team.Tenant_Automation_Request__c=req2.Id;
  596. team.User__c = u2.id;
  597. insert team;
  598. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  599. system.debug('==team==' + team + '==id==' + team.id);
  600. TenantAutomationRequestHelper.tntMode = '';
  601. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  602. req2.sFTP_Site_Name__c = 'discover-HCM';
  603. req2.User_Name__c ='redrobin4';
  604. req2.Status__c = 'Submitted';
  605. req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  606. req2.Sandbox_Request_Cancelled__c = null;
  607. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  608. req2.Previous_Excemption_Count__c = 2;
  609. req2.JIRA_Id__c = 'TAR-test';
  610. req2.Integration_Status__c = 'Success';
  611. update req2;
  612. }
  613. test.stopTest();
  614. }
  615. static testmethod void NewUnitTest12() {
  616. //line 484
  617. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  618. for(Data_Migration__c dm : dmlist ){
  619. dm.Exclude_Triggers__c = true;
  620. }
  621. update dmlist;
  622. WTACustomerTenantTriggerHelper.skipTrigger = true;
  623. test.startTest();
  624. Case cse = new Case();
  625. cse.AccountId = acc.Id;
  626. cse.contactId = cntct.id;
  627. cse.Case_Type__c = 'Customer Care Request';//sumant
  628. insert cse;
  629. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  630. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  631. //****Create User******
  632. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  633. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  634. string username = 'user1@workdayinc.com.testcoverage';
  635. User u2 = new User(
  636. Username = username,
  637. Email = username,
  638. Alias = 'Atester',
  639. LastName = 'user1Nametester',
  640. EmailEncodingKey = 'UTF-8',
  641. LanguageLocaleKey = 'en_US',
  642. LocaleSidKey = 'en_US',
  643. TimeZoneSidKey = 'GMT',
  644. ProfileId = p.Id
  645. );
  646. //u2.ContactId=partnerContact2.Id;
  647. insert u2;
  648. system.debug('==u2==' + u2);
  649. //****Create User******
  650. system.runAs(u2)
  651. {
  652. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  653. req2.Tenant_Management_Area__c=wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  654. req2.Destination_Tenant__c=provisionedtenant.Id;
  655. req2.Status__c='Submitted';
  656. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  657. req2.Customer__c = acc.Id;
  658. req2.request_Number__c='TAR-898989';
  659. req2.Origin__c='Customer Portal';
  660. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  661. req2.User_Name__c ='redrobin3';
  662. insert req2;
  663. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  664. // user u2 = [select id,email from user where id =: req2.CreatedById];
  665. // u2.email = 'test22@test22.com';
  666. // update u2;
  667. Tenant_Automation_Request_Team__c team;
  668. team = new Tenant_Automation_Request_Team__c();
  669. team.Tenant_Automation_Request__c=req2.Id;
  670. team.User__c = u2.id;
  671. insert team;
  672. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  673. system.debug('==team==' + team + '==id==' + team.id);
  674. TenantAutomationRequestHelper.tntMode = '';
  675. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  676. req2.sFTP_Site_Name__c = 'discover-HCM';
  677. req2.User_Name__c ='redrobin4';
  678. req2.Status__c = 'Submitted';
  679. req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  680. req2.Sandbox_Request_Cancelled__c = null;
  681. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  682. req2.Previous_Excemption_Count__c = 1;
  683. req2.JIRA_Id__c = 'TAR-test';
  684. req2.Integration_Status__c = 'Success';
  685. update req2;
  686. }
  687. test.stopTest();
  688. }
  689. static testmethod void NewUnitTest13() {
  690. //line 499
  691. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  692. for(Data_Migration__c dm : dmlist ){
  693. dm.Exclude_Triggers__c = true;
  694. }
  695. update dmlist;
  696. WTACustomerTenantTriggerHelper.skipTrigger = true;
  697. test.startTest();
  698. Case cse = new Case();
  699. cse.AccountId = acc.Id;
  700. cse.contactId = cntct.id;
  701. cse.Case_Type__c = 'Customer Care Request';//sumant
  702. insert cse;
  703. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  704. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  705. //****Create User******
  706. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  707. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  708. string username = 'user1@workdayinc.com.testcoverage';
  709. User u2 = new User(
  710. Username = username,
  711. Email = username,
  712. Alias = 'Atester',
  713. LastName = 'user1Nametester',
  714. EmailEncodingKey = 'UTF-8',
  715. LanguageLocaleKey = 'en_US',
  716. LocaleSidKey = 'en_US',
  717. TimeZoneSidKey = 'GMT',
  718. ProfileId = p.Id
  719. );
  720. //u2.ContactId=partnerContact2.Id;
  721. insert u2;
  722. system.debug('==u2==' + u2);
  723. //****Create User******
  724. system.runAs(u2)
  725. {
  726. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  727. req2.Tenant_Management_Area__c=wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  728. req2.Destination_Tenant__c=provisionedtenant.Id;
  729. req2.Status__c='Pending';
  730. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  731. req2.Customer__c = acc.Id;
  732. req2.request_Number__c='TAR-898989';
  733. req2.Origin__c='Customer Portal';
  734. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  735. req2.User_Name__c ='redrobin3';
  736. req2.Sandbox_Request_Cancelled__c = null;
  737. insert req2;
  738. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  739. // user u2 = [select id,email from user where id =: req2.CreatedById];
  740. // u2.email = 'test22@test22.com';
  741. // update u2;
  742. Tenant_Automation_Request_Team__c team;
  743. team = new Tenant_Automation_Request_Team__c();
  744. team.Tenant_Automation_Request__c=req2.Id;
  745. team.User__c = u2.id;
  746. insert team;
  747. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  748. system.debug('==team==' + team + '==id==' + team.id);
  749. TenantAutomationRequestHelper.tntMode = 'Edit';
  750. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  751. req2.sFTP_Site_Name__c = 'discover-HCM';
  752. req2.User_Name__c ='redrobin4';
  753. req2.Status__c = 'Pending';
  754. req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  755. req2.Sandbox_Request_Cancelled__c = null;
  756. req2.Due_Date__c= (Date.newInstance(2020, 1, 1)) + 2000;
  757. req2.Previous_Excemption_Count__c = 2;
  758. update req2;
  759. }
  760. test.stopTest();
  761. }
  762. static testmethod void NewUnitTest14() {
  763. //line 512
  764. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  765. for(Data_Migration__c dm : dmlist ){
  766. dm.Exclude_Triggers__c = true;
  767. }
  768. update dmlist;
  769. WTACustomerTenantTriggerHelper.skipTrigger = true;
  770. test.startTest();
  771. Case cse = new Case();
  772. cse.AccountId = acc.Id;
  773. cse.contactId = cntct.id;
  774. cse.Case_Type__c = 'Customer Care Request';//sumant
  775. insert cse;
  776. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  777. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  778. //****Create User******
  779. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  780. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  781. string username = 'user1@workdayinc.com.testcoverage';
  782. User u2 = new User(
  783. Username = username,
  784. Email = username,
  785. Alias = 'Atester',
  786. LastName = 'user1Nametester',
  787. EmailEncodingKey = 'UTF-8',
  788. LanguageLocaleKey = 'en_US',
  789. LocaleSidKey = 'en_US',
  790. TimeZoneSidKey = 'GMT',
  791. ProfileId = p.Id
  792. );
  793. //u2.ContactId=partnerContact2.Id;
  794. insert u2;
  795. system.debug('==u2==' + u2);
  796. //****Create User******
  797. system.runAs(u2)
  798. {
  799. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  800. req2.Tenant_Management_Area__c=wta_helper.PRODUCTION_END_ACTIVE_SESSIONS;
  801. req2.Destination_Tenant__c=provisionedtenant.Id;
  802. req2.Status__c='Pending';
  803. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  804. req2.Customer__c = acc.Id;
  805. req2.request_Number__c='TAR-898989';
  806. req2.Origin__c='Customer Portal';
  807. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  808. req2.User_Name__c ='redrobin3';
  809. req2.Sandbox_Request_Cancelled__c = null;
  810. insert req2;
  811. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  812. // user u2 = [select id,email from user where id =: req2.CreatedById];
  813. // u2.email = 'test22@test22.com';
  814. // update u2;
  815. Tenant_Automation_Request_Team__c team;
  816. team = new Tenant_Automation_Request_Team__c();
  817. team.Tenant_Automation_Request__c=req2.Id;
  818. team.User__c = u2.id;
  819. insert team;
  820. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  821. system.debug('==team==' + team + '==id==' + team.id);
  822. TenantAutomationRequestHelper.tntMode = 'Edit';
  823. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  824. req2.sFTP_Site_Name__c = 'discover-HCM';
  825. req2.User_Name__c ='redrobin4';
  826. req2.Status__c = 'Pending';
  827. req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  828. req2.Sandbox_Request_Cancelled__c = null;
  829. req2.Due_Date__c= (Date.newInstance(2020, 1, 1)) + 2000;
  830. req2.Previous_Excemption_Count__c = 2;
  831. update req2;
  832. }
  833. test.stopTest();
  834. }
  835. static testmethod void NewTest12() {
  836. //line 365 - else block
  837. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  838. for(Data_Migration__c dm : dmlist ){
  839. dm.Exclude_Triggers__c = true;
  840. }
  841. update dmlist;
  842. WTACustomerTenantTriggerHelper.skipTrigger = true;
  843. test.startTest();
  844. Case cse = new Case();
  845. cse.AccountId = acc.Id;
  846. cse.contactId = cntct.id;
  847. cse.Case_Type__c = 'Customer Care Request';//sumant
  848. insert cse;
  849. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  850. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  851. //****Create User******
  852. Contact partnerContact2 = TEST_DB_Core.getContact(partnerAccount, 'Partner Contact');
  853. Profile p = [select p.Id from Profile p where p.Name = 'System Administrator'];
  854. string username = 'user1@workdayinc.com.testcoverage';
  855. User u2 = new User(
  856. Username = username,
  857. Email = username,
  858. Alias = 'Atester',
  859. LastName = 'user1Nametester',
  860. EmailEncodingKey = 'UTF-8',
  861. LanguageLocaleKey = 'en_US',
  862. LocaleSidKey = 'en_US',
  863. TimeZoneSidKey = 'GMT',
  864. ProfileId = p.Id
  865. );
  866. //u2.ContactId=partnerContact2.Id;
  867. insert u2;
  868. system.debug('==u2==' + u2);
  869. //****Create User******
  870. system.runAs(u2)
  871. {
  872. TenantAutomationRequestHelper.tntMode ='Edit';
  873. Tenant_Automation_request__c req2 = new Tenant_Automation_request__c();
  874. req2.Tenant_Management_Area__c=wta_helper.TENANT_ACCESS_IMPLEMENTER;
  875. req2.Destination_Tenant__c=provisionedtenant.Id;
  876. req2.Status__c='Submitted';
  877. req2.Due_Date__c= Date.newInstance(2020, 1, 1);
  878. req2.Customer__c = acc.Id;
  879. req2.request_Number__c='TAR-898989';
  880. req2.Origin__c='Customer Portal';
  881. req2.End_Point__c ='wd5-impl-sftp.workday.com';
  882. req2.User_Name__c ='redrobin3';
  883. insert req2;
  884. system.debug('==insert req2==' + req2 + '==created by id' + req2.CreatedById);
  885. // user u2 = [select id,email from user where id =: req2.CreatedById];
  886. // u2.email = 'test22@test22.com';
  887. // update u2;
  888. Tenant_Automation_Request_Team__c team;
  889. team = new Tenant_Automation_Request_Team__c();
  890. team.Tenant_Automation_Request__c=req2.Id;
  891. team.User__c = u2.id;
  892. insert team;
  893. team =[Select User__c, Tenant_Automation_Request__c, Id, User__r.UserType, User__r.Id, User__r.UserName,User__r.Email From Tenant_Automation_Request_Team__c where Tenant_Automation_Request__c =: req2.Id];
  894. system.debug('==team==' + team + '==id==' + team.id);
  895. TenantAutomationRequestHelper.tntMode = '';
  896. req2.End_Point__c = 'wd6-impl-sftp.workday.com';
  897. req2.sFTP_Site_Name__c = 'discover-HCM';
  898. req2.User_Name__c ='redrobin4';
  899. req2.Status__c = 'Submitted';
  900. //req2.Tenant_Management_Area__c = wta_helper.SANDBOX_REFRESH_EXEMPTION;
  901. req2.Sandbox_Request_Cancelled__c = null;
  902. req2.Due_Date__c= (Date.newInstance(2020, 1, 1)) + 2000;
  903. req2.Sandbox_Request_Cancelled__c = null;
  904. req2.Previous_Excemption_Count__c = 2;
  905. update req2;
  906. }
  907. test.stopTest();
  908. }
  909. /*
  910. static testMethod void myUnitTestSandboxRefreshExemption() {
  911. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  912. for(Data_Migration__c dm : dmlist ){
  913. dm.Exclude_Triggers__c = true;
  914. }
  915. update dmlist;
  916. WTACustomerTenantTriggerHelper.skipTrigger = true;
  917. test.startTest();
  918. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  919. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  920. Tenant_Automation_Request__c req = new Tenant_Automation_Request__c();
  921. req.Tenant_Management_Area__c=WTA_Helper.SANDBOX_REFRESH_EXEMPTION;
  922. req.Destination_Tenant__c=provisionedtenant.Id;
  923. req.Status__c='Submitted';
  924. req.Due_Date__c= Date.newInstance(2020, 1, 1);
  925. req.Customer__c = acc.Id;
  926. req.Request_Number__c='TAR-898987';
  927. req.Origin__c='Customer Portal';
  928. req.Previous_Excemption_Count__c=0;
  929. req.End_Point__c = 'sftp-impl.workday.com';
  930. insert req;
  931. Tenant_Automation_Request_Team__c team = new Tenant_Automation_Request_Team__c();
  932. team.Tenant_Automation_Request__c=req.Id;
  933. team.User__c = u.Id;
  934. insert team;
  935. team = new Tenant_Automation_Request_Team__c();
  936. team.Tenant_Automation_Request__c=req.Id;
  937. team.User__c = UserInfo.getUserId();
  938. insert team;
  939. req.Previous_Excemption_Count__c=1;
  940. req.Due_Date__c= Date.newInstance(2020, 2, 1);
  941. update req;
  942. System.debug('req.status :: '+req.status__c);
  943. req.status__c='Completed';
  944. update req;
  945. System.debug('req.status :: '+req.status__c);
  946. req.status__c='Cancelled';
  947. update req;
  948. System.debug('req.status :: '+req.status__c);
  949. test.stopTest();
  950. }
  951. */
  952. /*
  953. static testMethod void myUnitTestSandboxRefreshExemption2nd() {
  954. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  955. for(Data_Migration__c dm : dmlist ){
  956. dm.Exclude_Triggers__c = true;
  957. }
  958. update dmlist;
  959. WTACustomerTenantTriggerHelper.skipTrigger = true;
  960. test.startTest();
  961. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  962. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  963. Tenant_Automation_Request__c req = new Tenant_Automation_Request__c();
  964. req.Tenant_Management_Area__c=WTA_Helper.SANDBOX_REFRESH_EXEMPTION;
  965. req.Destination_Tenant__c=provisionedtenant.Id;
  966. req.Status__c='Submitted';
  967. req.Due_Date__c= Date.newInstance(2020, 1, 1);
  968. req.Customer__c = acc.Id;
  969. req.Request_Number__c='TAR-898987';
  970. req.Origin__c='Customer Portal';
  971. req.Previous_Excemption_Count__c=2;
  972. req.End_Point__c = 'sftp-impl.workday.com';
  973. insert req;
  974. Tenant_Automation_Request_Team__c team = new Tenant_Automation_Request_Team__c();
  975. team.Tenant_Automation_Request__c=req.Id;
  976. team.User__c = u.Id;
  977. insert team;
  978. team = new Tenant_Automation_Request_Team__c();
  979. team.Tenant_Automation_Request__c=req.Id;
  980. team.User__c = UserInfo.getUserId();
  981. insert team;
  982. req.Status__c='Submitted';
  983. req.Due_Date__c= Date.newInstance(2019, 2, 1);
  984. //req.Sandbox_Request_Cancelled__c=null;
  985. update req;
  986. req.Status__c='Submitted';
  987. req.Due_Date__c= Date.newInstance(2019, 3, 1);
  988. req.Sandbox_Request_Cancelled__c=null;
  989. req.Previous_Excemption_Count__c=2;
  990. update req;
  991. System.debug('req.status :: '+req.status__c);
  992. req.status__c='Completed';
  993. update req;
  994. System.debug('req.status :: '+req.status__c);
  995. req.status__c='Cancelled';
  996. update req;
  997. System.debug('req.status :: '+req.status__c);
  998. req.Status__c='Submitted';
  999. req.Due_Date__c= Date.newInstance(2019, 4, 1);
  1000. req.Sandbox_Request_Cancelled__c=null;
  1001. req.Previous_Excemption_Count__c=2;
  1002. update req;
  1003. req.status__c='Cancelled';
  1004. update req;
  1005. req.Status__c='Submitted';
  1006. req.Due_Date__c= Date.newInstance(2019, 5, 1);
  1007. req.Sandbox_Request_Cancelled__c=null;
  1008. req.Previous_Excemption_Count__c=1;
  1009. update req;
  1010. test.stopTest();
  1011. }
  1012. */
  1013. /*
  1014. static testMethod void myUnitTestProdKillSession() {
  1015. List<Data_Migration__c> dmlist = Test_DB_Core.dm();
  1016. for(Data_Migration__c dm : dmlist ){
  1017. dm.Exclude_Triggers__c = true;
  1018. }
  1019. update dmlist;
  1020. WTACustomerTenantTriggerHelper.skipTrigger = true;
  1021. test.startTest();
  1022. provisionedtenant = WTA_Generate_Test_Data.getTenant(acc, 'IMPL','','DUB','1',false,'Provisioned','PROD');
  1023. activetenant = WTA_Generate_Test_Data.getTenant(acc, 'PROD','','DUB','',true,'Active','PROD');
  1024. Tenant_Automation_Request__c req = new Tenant_Automation_Request__c();
  1025. req.Tenant_Management_Area__c=WTA_Helper.PRODUCTION_END_ACTIVE_SESSIONS;
  1026. req.Destination_Tenant__c=provisionedtenant.Id;
  1027. req.Status__c='Submitted';
  1028. req.Due_Date__c= Date.newInstance(2020, 1, 1);
  1029. req.Customer__c = acc.Id;
  1030. req.Request_Number__c='TAR-898987';
  1031. //req.Origin__c='Customer Portal';
  1032. insert req;
  1033. Tenant_Automation_Request_Team__c team = new Tenant_Automation_Request_Team__c();
  1034. team.Tenant_Automation_Request__c=req.Id;
  1035. team.User__c = u.Id;
  1036. insert team;
  1037. req.Due_Date__c= Date.newInstance(2020, 2, 1);
  1038. update req;
  1039. req.status__c='Completed';
  1040. update req;
  1041. req.status__c='Cancelled';
  1042. update req;
  1043. test.stopTest();
  1044. }
  1045. */
  1046. }