| | |
| | | @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'; |
| | |
| | | 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); |
| | | |
| | | //20221208 lt DB202212060256 start |
| | | Campaign cam1 = new Campaign(); |
| | | cam1.Name = 'test campaign'; |
| | | cam1.StartDate = Date.today().addDays(18); |
| | | cam1.EndDate = Date.today().addDays(20); |
| | | cam1.Name2__c = '1234'; |
| | | cam1.Status = '申请中'; |
| | | cam1.Meeting_Type__c = '共同主办会'; |
| | | cam1.Mailflg_after45__c = true; |
| | | cam1.Mailflg_cancel__c = true; |
| | | cam1.Mailflg_before15__c = true; |
| | | cam1.Mailflg_before7__c = true; |
| | | cam1.Mailflg_after3__c = true; |
| | | cam1.HostName__c = '1'; |
| | | cam1.cooperatorCompany__c = '1'; |
| | | cam1.RecordTypeId = rectCo[0].Id; |
| | | cam1.OwnerId = user.Id; |
| | | cam1.Num__c = 'MT-GI-202203-5850'; |
| | | insert cam1; |
| | | system.debug('lt123cam.Num__c---'+cam.Num__c); |
| | | |
| | | cam1.StartDate = Date.today().addDays(28); |
| | | cam1.EndDate = Date.today().addDays(30); |
| | | update cam1; |
| | | //20221208 lt DB202212060256 end |
| | | } |
| | | |
| | | 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-12-28T00:00:00","SponsorshipCategory":"","SharedEditing":"on000695,on000630,om002080","ProcessState":120,"OfficeCategory":"GI(MEBG),ET(MEBG),","Num":"MT-GI-202203-5850","Name":"测试会议-001 (2022/03/28 - 2022/03/31)关联OBPM ","MeetingType":"线下","MeetingApprovedNo":"ME154P03-0009","IsPaidToSponsor":"否","IsCoOrganizingActivities":"N","HostName":"奥林巴斯","ExpectedOlympusAttendance":2,"ExpectedHcpAttendance":100,"EndDate":"2023-01-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); |
| | |
| | | NFM705Rest.doPost(); |
| | | |
| | | Test.stopTest(); |
| | | |
| | | } |
| | | } |