From 9b197b7fac92278fb591ea8f4942c7d5687cb5ce Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期一, 28 三月 2022 18:01:22 +0800
Subject: [PATCH] LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备0328
---
force-app/main/default/classes/NFM705RestTest.cls | 88 +++++++++++++++++++++++++++++++++++--------
1 files changed, 71 insertions(+), 17 deletions(-)
diff --git a/force-app/main/default/classes/NFM705RestTest.cls b/force-app/main/default/classes/NFM705RestTest.cls
index 7c29a2c..cc752e2 100644
--- a/force-app/main/default/classes/NFM705RestTest.cls
+++ b/force-app/main/default/classes/NFM705RestTest.cls
@@ -1,6 +1,19 @@
@isTest
public class NFM705RestTest {
+
static testMethod void testMothodOne(){
+ BatchIF_Transfer__c temp1 = new BatchIF_Transfer__c();
+ BatchIF_Transfer__c temp2 = new BatchIF_Transfer__c();
+ temp1.Table__c = 'Application_for_Conference_Adjudication__c';
+ temp1.Column__c = 'ProcessState__c';
+ temp1.External_Value__c = '110';
+ temp1.Internal_Value__c = '鑽夌';
+ insert temp1;
+ temp2.Table__c = 'Application_for_Conference_Adjudication__c';
+ temp2.Column__c = 'ProcessState__c';
+ temp2.External_Value__c = '120';
+ temp2.Internal_Value__c = '瀹℃壒涓�';
+ insert temp2;
BatchIF_Log__c testLog = new BatchIF_Log__c();
testLog.CurrencyIsoCode = 'CNY';
testLog.Type__c = 'NFM705';
@@ -9,35 +22,77 @@
testLog.ErrorLog__c = '';
testLog.MessageGroupNumber__c = '20211207';
testLog.RowDataFlg__c = true;
- testLog.Log__c = '[{"WorkshopPlace":"鏈潵鍩�","StateMaster":"璐靛窞","StartDate":"20221215","SponsorshipCategory":"鐧界粰","ProcessState": null ,"OfficeCategory":"1.娑堝寲绉�","Num":"MT-HB-202112-5773","Name":null,"MeetingType":"涓诲姙浼�","MeetingApprovedNo":null,"IsPaidToSponsor":"Y","HostName":"榛旇タ鍗楀窞涓尰闄�","EndDate":"20221216","CooperatorCompany":"鏈潵鍩�","ConveningParticipantsNum":50,"CityMaster":"璐甸槼","BudgetType":"鏂颁骇鍝佷笂甯�"}]';
+ testLog.Log__c = '[{"WorkshopPlace":"娌冲寳","StateMaster":"娌冲寳鐪�","StartDate":"2022-03-25T00:00:00","SponsorshipCategory":"","SharedEditing":"","ProcessState":110,"OfficeCategory":"","Num":"MT-GI-202203-5850","Name":"TEST璇存槑浼� (2022/01/13 - 2022/03/24) v1","MeetingType":"绾夸笂+绾夸笅","MeetingApprovedNo":"ME154P03-0007","IsPaidToSponsor":"鍚�","IsCoOrganizingActivities":"Y","HostName":"1","ExpectedOlympusAttendance":10,"ExpectedHcpAttendance":111,"EndDate":"2022-03-30T00:00:00","CooperatorCompany":"2","ConveningParticipantsNum":121,"CityMaster":"鐭冲搴勫競","BudgetType":"鍏朵粬","Applicant":"om001646","ActivityTypeName":"鑷富涓诲姙娲诲姩"}]';
//[Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowData_Id]
insert testLog;
NFM705Rest.main(testLog.Id);
+ testLog.Log__c = '[{"WorkshopPlace":"娌冲寳","StateMaster":"娌冲寳鐪�","StartDate":"2022-03-25T00:00:00","SponsorshipCategory":"","SharedEditing":"","ProcessState":120,"OfficeCategory":"","Num":"MT-GI-202203-5850","Name":"TEST璇存槑浼� (2022/01/13 - 2022/03/24) v1","MeetingType":"绾夸笂+绾夸笅","MeetingApprovedNo":"ME154P03-0007","IsPaidToSponsor":"鍚�","IsCoOrganizingActivities":"Y","HostName":"1","ExpectedOlympusAttendance":10,"ExpectedHcpAttendance":111,"EndDate":"2022-03-30T00:00:00","CooperatorCompany":"2","ConveningParticipantsNum":121,"CityMaster":"鐭冲搴勫競","BudgetType":"鍏朵粬","Applicant":"om001646","ActivityTypeName":"鑷富涓诲姙娲诲姩"}]';
+ update testLog;
+ NFM705Rest.main(testLog.Id);
+ //controller.ReservedProductVerification();
+ // string[] azzz = new String[]{'1','2'};
+ // system.debug(azzz[3]);
}
static testMethod void testMethodTwo() {
- BatchIF_Transfer__c transfer1 = new BatchIF_Transfer__c();
- transfer1.Table__c = 'Application_for_Conference_Adjudication__c';
- transfer1.Column__c = 'ProcessState__c';
- transfer1.External_Value__c = '110';
- transfer1.Internal_Value__c = '鑽夌';
- transfer1.Dropped_Flag__c = false;
- insert transfer1;
+ BatchIF_Transfer__c temp1 = new BatchIF_Transfer__c();
+ BatchIF_Transfer__c temp2 = new BatchIF_Transfer__c();
+ temp1.Table__c = 'Application_for_Conference_Adjudication__c';
+ temp1.Column__c = 'ProcessState__c';
+ temp1.External_Value__c = '110';
+ temp1.Internal_Value__c = '鑽夌';
+ insert temp1;
+ temp2.Table__c = 'Application_for_Conference_Adjudication__c';
+ temp2.Column__c = 'ProcessState__c';
+ temp2.External_Value__c = '120';
+ temp2.Internal_Value__c = '瀹℃壒涓�';
+ insert temp2;
- BatchIF_Transfer__c transfer2 = new BatchIF_Transfer__c();
- transfer2.Table__c = 'Application_for_Conference_Adjudication__c';
- transfer2.Column__c = 'IsPaidToSponsor__c';
- transfer2.External_Value__c = 'Y';
- transfer2.Internal_Value__c = '鏄�';
- transfer2.Dropped_Flag__c = false;
- insert transfer2;
+ List<RecordType> rectCo = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Campaign' and DeveloperName = 'Society'];
+ System.runAs(new User(Id = Userinfo.getUserId())) {
+ User user = new User(Test_staff__c = true);
+ user.LastName = '_銈点兂銉栥儶銉冦偢';
+ user.FirstName = '銇�';
+ user.Alias = '銇�';
+ user.Email = 'olympusTest03@sunbridge.com';
+ user.Username = 'olympusTest03@sunbridge.com';
+ user.IsActive = true;
+ user.EmailEncodingKey = 'ISO-2022-JP';
+ user.TimeZoneSidKey = 'Asia/Tokyo';
+ user.LocaleSidKey = 'ja_JP';
+ user.LanguageLocaleKey = 'ja';
+ user.ProfileId = System.Label.ProfileId_SystemAdmin;
+ user.Province__c = '鍖椾含';
+ user.Dept__c = '鍖荤枟鍗庡寳钀ヤ笟鏈儴';
+ user.Use_Start_Date__c = Date.today().addMonths(-6);
+ insert user;
+ Campaign cam = new Campaign();
+ cam.Name = 'test campaign';
+ cam.StartDate = Date.today().addDays(15);
+ cam.EndDate = Date.today().addDays(18);
+ cam.Name2__c = '1234';
+ cam.Status = '鐢宠涓�';
+ cam.Mailflg_after45__c = true;
+ cam.Mailflg_cancel__c = true;
+ cam.Mailflg_before15__c = true;
+ cam.Mailflg_before7__c = true;
+ cam.Mailflg_after3__c = true;
+ cam.HostName__c = '1';
+ cam.cooperatorCompany__c = '1';
+ cam.RecordTypeId = rectCo[0].Id;
+ cam.OwnerId = user.Id;
+ cam.Num__c = 'MT-XN-202203-5854';
+ insert cam;
+ system.debug('cam.Num__c'+cam.Num__c);
+ }
+
Test.startTest();
RestRequest req = new RestRequest();
RestResponse res = new RestResponse();
- String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"鏈潵鍩�","StateMaster":"璐靛窞","StartDate":"20251215","SponsorshipCategory":"鐧界粰","ProcessState":110,"OfficeCategory":"1.娑堝寲绉�","Num":null,"Name":"Test浼氳","MeetingType":"涓诲姙浼�","MeetingApprovedNo":"TEST997931","IsPaidToSponsor":"Y","HostName":"榛旇タ鍗楀窞涓尰闄�","EndDate":"20251216","CooperatorCompany":"鏈潵鍩�","ConveningParticipantsNum":50,"CityMaster":"瀹夐『","BudgetType":"鏂颁骇鍝佷笂甯�","ActivityTypeName":"鍡紵涔栦箹绔欏ソ锛�","ExpectedOlympusAttendance":50,"ExpectedHcpAttendance":100}]}';
+ String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"浜戝崡","StateMaster":"浜戝崡鐪�","StartDate":"2022-03-28T00:00:00","SponsorshipCategory":"","SharedEditing":"on000695,on000630,om002080","ProcessState":120,"OfficeCategory":"GI锛圡EBG锛�,ET锛圡EBG锛�,","Num":"MT-XN-202203-5854","Name":"娴嬭瘯浼氳-001 (2022/03/28 - 2022/03/31)鍏宠仈OBPM ","MeetingType":"绾夸笅","MeetingApprovedNo":"ME154P03-0009","IsPaidToSponsor":"鍚�","IsCoOrganizingActivities":"N","HostName":"濂ユ灄宸存柉","ExpectedOlympusAttendance":2,"ExpectedHcpAttendance":100,"EndDate":"2022-04-09T00:00:00","CooperatorCompany":"鏃�","ConveningParticipantsNum":102,"CityMaster":"鏄嗘槑甯�","BudgetType":"浜у搧鎺ㄥ箍","Applicant":"om001646","ActivityTypeName":"鑷富涓诲姙娲诲姩"}]}';
req.requestURI = 'services/apexrest/NFM705/execute';
req.httpMethod = 'POST';
req.requestBody = Blob.valueof(JsonMsg);
@@ -47,6 +102,5 @@
NFM705Rest.doPost();
Test.stopTest();
-
}
}
\ No newline at end of file
--
Gitblit v1.9.1