function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lakshman.mattilakshman.matti 

Callout Exception

Hi Everyone,

While writting test class webservice callouts, i'm getting the following Exception.
you have uncommitted work pending. Please commit or rollback before calling out.

my test class:
----------------------
@isTest
public class GSD_partordercontroller_TESTROH {
    
    private static void createCustomSetting(){
            HPTriggerFrameworkObjectMapping__c CSPOobj=new HPTriggerFrameworkObjectMapping__c(Name='GSD_Part_Order__c ', DispatcherCalssName__c='GSDPartOrder');
            insert CSPOobj;
            HPTriggerFrameworkObjectMapping__c CSPOLobj=new HPTriggerFrameworkObjectMapping__c(Name='GSD_Part_Order_Line__c', DispatcherCalssName__c='GSDPartOrderLine');
            insert CSPOLobj;
            HPTriggerFrameworkObjectMapping__c trigFramework = new HPTriggerFrameworkObjectMapping__c(name = 'CKSW__Task__c',DispatcherCalssName__c = 'GSDTask');
            insert trigFramework;
            HPTriggerFrameworkObjectMapping__c resourceCS = new HPTriggerFrameworkObjectMapping__c(name = 'CKSW__Engineer_Equipment__c',DispatcherCalssName__c = 'GSDResource');
            insert resourceCS;
            HPTriggerFrameworkObjectMapping__c GsdCaseQuote=new HPTriggerFrameworkObjectMapping__c(name='GSD_Case_Quote__c',DispatcherCalssName__c='GSDCaseQuote');
            insert GsdCaseQuote;
             HPTriggerFrameworkObjectMapping__c partPickLoCObj=new HPTriggerFrameworkObjectMapping__c(name='GSD_Part_Pickup_Location__c',DispatcherCalssName__c='GSDPartPickupLocation');
            insert partPickLoCObj;

        } 
Private testmethod static void MethodFROH(){
        createCustomSetting();
   // Test.setMock(WebServiceMock.class, new GSDTrunkPartOrderWebMockIml());
    test.startTest();
    CKSW__Engineer_Equipment__c resourecObj =  new CKSW__Engineer_Equipment__c( Name='Test resource',Standby_Dispatch_Policy__c='Bulk',
                                                                                    Mobile__c='9663066004', CKSW__User__c=userinfo.getUserId());
        insert resourecObj;
        
        GSD_Business_Center__c buscenter= new GSD_Business_Center__c(Name='Test Business' ,Business_Center_Key__c=123456,Active__c=true);
        insert buscenter;
        
        Account newAccount= new Account(Name='Test Account');
        insert newAccount;
        contact newContact =new contact(FirstName='Joe',LastName='Smith',Phone='415.555.1212',AccountId=newAccount.Id);
        Asset AsetObj=new Asset();
        AsetObj.name='as1';
        AsetObj.HP_Product_Number__c='H4U87ES';
        AsetObj.HP_Asset_Type__c='PPS GSB Asset';
        AsetObj.Manufacturer__c='HP DesignJet (PL30)';
        AsetObj.Status='Active';
        AsetObj.HP_Product_Model__c='30 - DesignJet HW';
        AsetObj.AccountId=newAccount.Id;
        insert AsetObj;
        BusinessHours newBusHours= new BusinessHours(Name='Default');
        Case newCase= new Case(status='open', BusinessHours=newBusHours,source_system_case_id__c='98000057131', 
                               Severity__c='3-NORMAL', Description='Test Description', OwnerId=userinfo.getUserId(),Reason='ABP Support',NBD_SBD__c='NBD');
        newCase.Requestor_s_TimeZone__c='(GMT+00:00) British Standard Time (Europe/London)';
        newCase.AssetId=AsetObj.Id;
        newcase.Last_Service_Delivery_Time__c=system.now()+1;
        newCase.Entitlement_SLA_Response__c='RESPONSE_TIME';
        newCase.Latest_Service_DateTime__c=system.now();
        newCase.Mission_Critical__c=true;
        newCase.OrderTypeCode__c='00E-No Entitlement';
        insert newCase;
        GSD_Part_Order__c POObj=new GSD_Part_Order__c(name='Po',Legacy_Part_Order_number__c='1234567891-123-1');
        POObj.ISO2_Character_Country_Code__c='AX'; 
        POObj.Country__c='AF';
        POObj.Order_Reason_Code__c='615-Customer Self Repair (CSR)';
        POObj.Shipping_Condition_Code__c='SBD';
        POObj.Shipping_Carrier_Code__c='S3-DHL';
        POObj.Case_Number__c=newcase.id;
        POObj.Part_Delivery_Requested_TimeStamp__c=system.now();
        POObj.Part_Order_Type_Code__c='ZSSB Exchange Order';
        POObj.Delivery_Priority_Code__c='40-Manual Escalations';
        POObj.Special_Delivery_Process_Code__c='21-Next Flight Out';
        insert POObj;
        GSD_Part_Order_Line__c partorderline=new GSD_Part_Order_Line__c(name='pol',Part_Order_Header_Number__c=POObj.Id);
         partorderline.Logistics_Estimated_Arrival_TimeStamp__c=system.now()+1;
         partorderline.Part_Response_Status_Code__c='BACKORDER';
         partorderline.Offered_Part_Identifier__c='abcOfr';
         partorderline.Part_Identifier__c='Test';
         partorderline.Part_Line_Status__c='Cancelled';
         partorderline.Part_Description__c='Description';
        insert partorderline;
        World_Region__c WR=new World_Region__c();
        wr.Name='AX';
        insert WR;
        World_Region_Configuration__c WRCObj=new World_Region_Configuration__c();
        WRCObj.Text_Value__c='test';
        WRCObj.World_Region__c=WR.Id;
        WRCObj.Name='GSD_iGSO_Sales_Organization';
        insert WRCObj;
        GSD_ODM_Reference__c ODMObj=new GSD_ODM_Reference__c();
        ODMObj.name='odm123';
        insert ODMObj;
        list<gsd_offer__C> LIObj=new list<gsd_offer__C>();
        gsd_offer__C OFFObj=new gsd_offer__C();
        OFFObj.name='off1';
        OFFObj.Case__c=newCase.Id;
        OFFObj.Offer_Reference__c=ODMObj.Id;
        OFFObj.Start_Date__c=system.today();
        OFFObj.End_Date__c=system.today()+1; 
        OFFObj.Entitlement_Type_Code__c='W';
        insert OFFObj;
        LIObj.add(OFFObj);
        GSD_Integration_Data__c trunkpartorder=new GSD_Integration_Data__c();
        trunkpartorder.End_point_URL__c='https://it-services-gw-csc-stg.itcs.hp.com/gw/hpit/egit/createtrunkpartorder.itg';
        trunkpartorder.Name='Trunkpartorder';
        trunkpartorder.Time_out__c=120000;
        trunkpartorder.Client_Certificate__c='';
        insert trunkpartorder; 
        
        Apexpages.StandardController sc = new Apexpages.standardController(POObj);
        GSD_PartOrderController POCObj=new GSD_PartOrderController(sc);
        POCObj.closeValidateAddressPopUp();
        POCObj.caseobj=newcase;
        POCObj.orderobj=POObj;
        POCObj.orderid='';
        POCObj.partorderid=POObj.id;
        //MonitorUtility objmonitorutility=new MonitorUtility();
        POCObj.Transactionid='TrunkPartOrder';
        GSDCustomerTimeZoneUtility LTZObj=new GSDCustomerTimeZoneUtility();
        string tZ='(GMT+09:00) Japan Standard Time (Asia/Tokyo)';
        GSDCustomerTimeZoneUtility.LongNameToTimeZone(tZ);
        
     
   // GsdTrunkpartorderCreateResponse.CreateTrunkPartOrderEndpoint3 resObj=new GsdTrunkpartorderCreateResponse.CreateTrunkPartOrderEndpoint3();
    test.stopTest();
    Test.setMock(WebServiceMock.class, new GSDTrunkPartOrderWebMockIml());  
    
    POCObj.TrunkPartorder();
    
    }
       private testmethod static void methodFEntitleElseblcok(){
        
        createCustomSetting();
        CKSW__Engineer_Equipment__c resourecObj =  new CKSW__Engineer_Equipment__c( Name='Test resource',Standby_Dispatch_Policy__c='Bulk',
                                                                                    Mobile__c='9663066004', CKSW__User__c=userinfo.getUserId());
        insert resourecObj;
        
        GSD_Business_Center__c buscenter= new GSD_Business_Center__c(Name='Test Business' ,Business_Center_Key__c=123456,Active__c=true);
        insert buscenter;
        
        Account newAccount= new Account(Name='Test Account');
        insert newAccount;
        contact newContact =new contact(FirstName='Joe',LastName='Smith',Phone='415.555.1212',AccountId=newAccount.Id);
        Asset AsetObj=new Asset();
        AsetObj.name='as1';
        AsetObj.HP_Product_Number__c='H4U87ES';
        AsetObj.HP_Asset_Type__c='PPS GSB Asset';
        AsetObj.Manufacturer__c='HP DesignJet (PL30)';
        AsetObj.Status='Active';
        AsetObj.HP_Product_Model__c='30 - DesignJet HW';
        AsetObj.AccountId=newAccount.Id;
        insert AsetObj;
        BusinessHours newBusHours= new BusinessHours(Name='Default');
        Case newCase= new Case(status='open', BusinessHours=newBusHours,source_system_case_id__c='98000057131', 
                               Severity__c='3-NORMAL', Description='Test Description', OwnerId=userinfo.getUserId(),Reason='ABP Support',NBD_SBD__c='SBD');
        newCase.Mission_Critical__c=true;
        newCase.AssetId=AsetObj.Id;
        newcase.Last_Service_Delivery_Time__c=system.now()+1;
        insert newCase;
       // ApexPages.currentPage().getParameters().put('caseid', newCase.Id);
        GSD_Case_Quote__c quote = new GSD_Case_Quote__c(name = 'Test Quote', Case__c = newCase.id);
        insert quote;
        
        CKSW__TaskType__c taskType= new CKSW__TaskType__c(Name='Repair', CKSW__Duration__c=20);
        insert taskType;
        CKSW__WorkOrder__c workOrder= new CKSW__WorkOrder__c(CKSW__Account__c=newAccount.Id,
                                      CKSW__StartDate__c=Date.Today(), CKSW__EndDate__c=Date.Today());
        insert workOrder;
        CKSW__Task__c taskRec = new CKSW__Task__c(CKSW__WorkOrder__c=workOrder.Id, CKSW__TaskType__c=taskType.Id,Business_Center__c=buscenter.Id,
                                                  External_Task_Identifier__c='98000057131-971', CKSW__Assigned_Resource__c=resourecObj.Id,Product_Number__c='123',Serial_Number__c='S123',Case_Quote__c=quote.id);
        taskRec.Entitled_Service_Window_Start_DateTime__c=system.now();
        taskRec.Requested_Service_Window_Start_DateTime__c=system.now();
        taskRec.Entitled_Service_Window_End_DateTime__c=system.now();
        taskRec.Requested_Service_Window_End_DateTime__c=system.now();
        taskRec.CKSW__Country__c='India';
        taskRec.CKSW__Street__c='biji';
        taskREc.CKSW__City__c='Bangalore';
        taskRec.CKSW__State__c='Karnataka';
        taskREc.CKSW__Zip_Postal_Code__c='560100';
        insert taskRec ;
       
        GSD_ODM_Reference__c ODMObj=new GSD_ODM_Reference__c();
        ODMObj.name='odm123';
        insert ODMObj;
        
        ApexPages.currentPage().getParameters().put('caseid', newCase.Id);
        GSD_Part_Order__c POObj=new GSD_Part_Order__c(Case_Number__c=newCase.id,Service_Delivery_Type__c='Onsite');
        POObj.Legacy_Part_Order_number__c='1234567890-123-1';
        POObj.Pending_Transaction_Type__c='Trans';
        POObj.ISO2_Character_Country_Code__c='AX';
        POObj.Shipping_Carrier_Code__c='S1-Postal Service';
        POObj.Shipping_Condition_Code__c='None';
        POObj.Service_Delivery_Type__c='CSR';
        POObj.Delivery_Priority_Code__c='None';
        POObj.Street2__c='street2';
        POObj.Company_Name__c='company1';
        POObj.Responsible_Party_Id__c='RPID';
        POObj.Order_Status_Code__c='Recommended';
        insert POObj;
        World_Region__c WR=new World_Region__c();
        wr.Name='AX';
       // Wr.ParentId__c=POObj.ISO2_Character_Country_Code__c;
       
        insert WR;
        list<World_Region_Configuration__c> lstwrc=new list<World_Region_Configuration__c>();
        World_Region_Configuration__c wrObj=new World_Region_Configuration__c();
           
        wrObj.World_Region__c=wr.Id;
        wrObj.Name='GSD_iGSO_Sales_Organization';
        insert wrObj;
        lstwrc.add(wrobj);
        
        GSD_Part_Order_Line__c partorderline=new GSD_Part_Order_Line__c(name='pol',Part_Order_Header_Number__c=POObj.Id);
        partorderline.Part_Line_Status__c='On Hold';
        partorderline.Part_Identifier__c='PI';
        insert partorderline;
        List<GSD_Part_Order_Line__c> WLPOLObj=new List<GSD_Part_Order_Line__c>();
        WLPOLObj.add(partorderline); 
        
        list<gsd_offer__C> LIObj=new list<gsd_offer__C>();
        gsd_offer__C OFFObj=new gsd_offer__C();
        OFFObj.name='off1';
        OFFObj.Case__c=newCase.Id;
        OFFObj.Offer_Reference__c=ODMObj.Id;
        OFFObj.Start_Date__c=system.today();
        OFFObj.End_Date__c=system.today()+1;        
        insert OFFObj;
        LIObj.add(OFFObj);
        
        Apexpages.StandardController sc = new Apexpages.standardController(POObj);
        GSD_PartOrderController POCObj=new GSD_PartOrderController(sc);
        GSD_PartOrderController.postback=true;
        POCObj.CaseId=newCase.id;
        POCObj.TaskId=taskRec.Id;
        POCObj.partorderid=POObj.id;
        POCObj.taskObj=taskRec;
        
        boolean isChecked=true;
        boolean isSLAmet=true;
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('US','US'));
        String PromisedTimeCOnvertedtoCTZ='re';
        GSD_PartOrderController.partOrderLineWrapper POLObj=new GSD_PartOrderController.partOrderLineWrapper(isChecked,isSLAmet,partorderline,options,PromisedTimeCOnvertedtoCTZ);
        list<GSD_PartOrderController.partOrderLineWrapper> WPOLObj=new list<GSD_PartOrderController.partOrderLineWrapper>();
        WPOLObj.add(POLObj);
        POCObj.wl= WPOLObj;
        POCObj.onPageLoad();
        POCObj.closeValidateAddressPopUp();
        POCObj.FillEntitlementsection();
        

        GsdAtpStream ATPObj=new GsdAtpStream();
        GsdAtpStream.GetATPType GetAtp=new GsdAtpStream.GetATPType();
        GsdAtpStream.AddressBlock_element Address=new GsdAtpStream.AddressBlock_element ();
        GsdAtpStream.InPartList_element InPart=new GsdAtpStream.InPartList_element();
        GsdAtpStream.GetATPResponseType Res=new GsdAtpStream.GetATPResponseType();
        GsdAtpStream.PartList_element PartElement=new GsdAtpStream.PartList_element();
        GsdAtpStream.PortTypeEndpoint1  port=new GsdAtpStream.PortTypeEndpoint1();
        GsdAtpStream.FaultMessageType Msg=new GsdAtpStream.FaultMessageType();
         GSD_Integration_Data__c GSDI=new  GSD_Integration_Data__c(name='ATP',End_point_URL__c='https://it-services-gw-csc-stg.itcs.hp.com/gw/hpit/egit/getatp.itg',Time_out__c=120000,Client_Certificate__c='');
         insert GSDI;
           
        GSDIntegrationUtilityClass objIntegrationData = new GSDIntegrationUtilityClass();
           string strServicename='ATP';
           objIntegrationData.GetEndpointData(strServicename);
       test.startTest();
       Test.setMock(WebServiceMock.class, new GsdAtpStreamWebMockIml()); 
        POCObj.checkAvail();
        POCObj.partlineid=partorderline.id;
        POCObj.checkAvailSupressEqualent();
       test.stopTest();
    }
   
    
}
can some one tel me how to resolve this issue.
Regards
Lakshman
Bhanu PartapBhanu Partap
Hi
read those help full topic for your problem
https://help.salesforce.com/apex/HTViewSolution?id=000003701.
https://help.salesforce.com/apex/HTViewSolution?id=000079772&language=en_US

Try to avoid any DML Operation before any of call out if required use future call for DMl.
lakshman.mattilakshman.matti
Thanks Bhanu for reply.

Here i'm not talking about page raleted.
i'm even pasted my test code also.please answer on the same.
Regards
Lakshminarayana
Bhanu PartapBhanu Partap
if you can post complete exception along with line number. 
lakshman.mattilakshman.matti
Thanks  bhanu,
POCObj.checkAvail();
this is the line where i'm getting the error.
below is error.

you have uncommitted work pending. Please commit or rollback before calling out.
Bhanu PartapBhanu Partap
 test.startTest();POCObj.checkAvail(); begins what is happening either code in function POCObj.checkAvail(); first performing DML operation then callout Please share GSD_PartOrderController class code.
lakshman.mattilakshman.matti
hi bhanu,
since the class was too big i cant post here.
simply in the checkAvail(); there is a callout happening.

public with SHARING class GSD_PartOrderController{
//Check availability
public void checkAvail()
{
    try
    {
        string strDeliveryPriorityCode,strShippingCarrierCode,strShippingConditionCode,strCEBadge;

        if(!string.isBlank(orderobj.Shipping_Carrier_Code__c))
            strShippingCarrierCode = orderobj.Shipping_Carrier_Code__c.substring(0,2);
        if(!string.isBlank(orderobj.Shipping_Condition_Code__c))
            strShippingConditionCode = orderobj.Shipping_Condition_Code__c.substring(0,2);

        if(orderObj.Service_Delivery_Type__c == 'CSR')
        {
            strSerialNumber=caseobj.asset.serialnumber;
            strProductNumber=caseobj.asset.HP_Product_Number__c;
        }
        else
        {
            strSerialNumber=taskObj.Serial_Number__c;
            strProductNumber=taskObj.Product_Number__c;
        }

        if(!string.isBlank(orderobj.Delivery_Priority_Code__c))
            strDeliveryPriorityCode = orderobj.Delivery_Priority_Code__c.substring(0,2);

        system.debug('strSerialNumber:'+strSerialNumber);
        system.debug('strProductNumber:'+strProductNumber);
        GsdAtpStream.PortTypeEndpoint1 objATPService = new GsdAtpStream.PortTypeEndpoint1();
        GSDIntegrationUtilityClass objGSDIntegrationUtilityClass = new GSDIntegrationUtilityClass();
        GSDIntegrationUtilityClass.IntegrationData objIntegrationData = new GSDIntegrationUtilityClass.IntegrationData();
        system.debug('Before getting end point data');
        objIntegrationData = objGSDIntegrationUtilityClass.GetEndpointData('ATP');
        system.debug('After getting end point data');
        objATPService.endpoint_x = objIntegrationData.strEndpointURL;
        system.debug('objIntegrationData.strEndpointURL' + objIntegrationData.strEndpointURL);
        objATPService.timeout_x = objIntegrationData.iTimeOut;
        system.debug('objIntegrationData.iTimeOut' + objIntegrationData.iTimeOut);

        objATPService.clientCertName_x='SFDC_Certificate';//ClientCertificate;
        //objATPService.endpoint_x='https://it-services-gw-csc-itg.external.hp.com/gw/hpit/egit/getatp.dev';
        //objATPService.timeout_x = 60000;

        GsdAtpStream.AddressBlock_element addBlock = new GsdAtpStream.AddressBlock_element();
        addBlock.ISO2CharacterCountryCode = orderobj.ISO2_Character_Country_Code__c;
        if(!string.IsBlank(orderobj.Street__c))
            addBlock.AddressLine1 = orderobj.Street__c;
        if(!string.IsBlank(orderobj.Street2__c))
            addBlock.AddressLine2 = orderobj.Street2__c;
        if(!string.IsBlank(orderobj.City__c))
            addBlock.CityName = orderobj.City__c;
        if(!string.IsBlank(orderobj.State__c))
            addBlock.CountryGeographyIdentifier = orderobj.State__c;
        if(!string.IsBlank(orderobj.Zip_Postal_Code__c))
            addBlock.PostalCode = orderobj.Zip_Postal_Code__c;
        if(!string.IsBlank(orderobj.Company_Name__c))
            addBlock.CompanyName = orderobj.Company_Name__c;
        if(!string.isBlank(orderobj.Responsible_Party_Id__c))
            strCEBadge = 'E' + orderobj.Responsible_Party_Id__c;

        GsdAtpStream.PartList_element PartList = new GsdAtpStream.PartList_element();
        GsdAtpStream.InPartList_element[] InpartList = new List<GsdAtpStream.InPartList_element>();
        list<gsd_part_order_line__c> lstPartLines = [select id,Part_Identifier__c,Part_Escalated_Flag__c from gsd_part_order_line__c where Part_Order_Header_Number__c=:partorderid];
        for(gsd_part_order_line__c partLineItem:lstPartLines)
        {
            GsdAtpStream.InPartList_element InPart1 = new GsdAtpStream.InPartList_element();
            InPart1.PartLineItemSfdcID = partLineItem.id;
            InPart1.PartIdentifier= partLineItem.Part_Identifier__c;
            InPart1.PartDeliveryRequestedCount= 1;
            if(!string.isBlank(strDeliveryPriorityCode))
                InPart1.DeliveryPriorityCode= strDeliveryPriorityCode;
            else
            InPart1.DeliveryPriorityCode= '';
            InPart1.SuppressFunctionalEquivalentFlag= false;
            if(orderobj.Part_Delivery_Requested_TimeStamp__c != null)
            {
                InPart1.PartDeliveryRequestedTimeStamp = orderobj.Part_Delivery_Requested_TimeStamp__c;
                partRequestedDateTime = orderobj.Part_Delivery_Requested_TimeStamp__c;
            }
            else
                InPart1.PartDeliveryRequestedTimeStamp = partRequestedDateTime;
            InpartList.add(InPart1);
            system.debug('partRequestedDateTime:'+partRequestedDateTime);
        }
        PartList.InPartList = InpartList;
        system.debug('partRequestedDateTime:'+partRequestedDateTime);
        system.debug('strSalesOrg:'+strSalesOrg);
        system.debug('PartList' + PartList);
        system.debug('orderobj.id:' + orderobj.Id);
        system.debug('orderobj.ISO2_Character_Country_Code__c:' + orderobj.ISO2_Character_Country_Code__c);
        ATPResponse = objATPService.GetATP(Transactionid,addBlock,strCEBadge,true,orderobj.ISO2_Character_Country_Code__c,'EN','',PartList,strProductNumber,strSerialNumber,strSalesOrg,'','',strShippingCarrierCode,strShippingConditionCode,'');
        if(ATPResponse.StatusCode=='200')
        {
            MonitorUtility.MonitorInputAttributes inputAttributeobj=new MonitorUtility.MonitorInputAttributes();
            inputAttributeobj.EndTime=system.now();
            inputAttributeobj.TransactionID=Transactionid;
            inputAttributeobj.Component='SF-PartsOffer-ATP';
            inputAttributeobj.SubComponent='ATP';
            inputAttributeobj.Organization='GSD';
            inputAttributeobj.Source='SFDC';
            inputAttributeobj.EndUser=userInfo.getuserName();
            inputAttributeobj.ResponseBody='';
            inputAttributeobj.ResponseStatus='200';
            inputAttributeobj.ResponseText ='Pass';
            inputAttributeobj.Domain='FSM';
            inputAttributeobj.RequestKeyName1='Caseid';
            inputAttributeobj.RequestKeyValue1=orderobj.legacy_part_order_number__C.substring(0,10);
            inputAttributeobj.RequestKeyName2='SerialNumber';
            inputAttributeobj.RequestKeyValue2=caseobj.asset.serialnumber;
            inputAttributeobj.RequestKeyName3='ProductNumber';
            inputAttributeobj.RequestKeyValue3=caseobj.asset.HP_Product_Number__c;
            inputAttributeobj.RequestKeyName4='PartOrderId';
            inputAttributeobj.RequestKeyValue4=orderobj.legacy_part_order_number__C;
            objmonitorutility.endMon(inputAttributeobj) ;
        }
        else
        {
            MonitorUtility.MonitorInputAttributes inputAttributeobj=new MonitorUtility.MonitorInputAttributes();
            inputAttributeobj.EndTime=system.now();
            inputAttributeobj.TransactionID=Transactionid;
            inputAttributeobj.Component='SF-PartsOffer-ATP';
            inputAttributeobj.SubComponent='ATP';
            inputAttributeobj.Organization='GSD';
            inputAttributeobj.Source='SFDC';
            inputAttributeobj.EndUser=userInfo.getuserName();
            inputAttributeobj.ResponseBody=ATPResponse.SatusMsg;
            inputAttributeobj.ResponseStatus='400';
            inputAttributeobj.ResponseText ='Fail';
            inputAttributeobj.Domain='FSM';
            inputAttributeobj.RequestKeyName1='Caseid';
            inputAttributeobj.RequestKeyValue1=orderobj.legacy_part_order_number__C.substring(0,10);
            inputAttributeobj.RequestKeyName2='SerialNumber';
            inputAttributeobj.RequestKeyValue2=caseobj.asset.serialnumber;
            inputAttributeobj.RequestKeyName3='ProductNumber';
            inputAttributeobj.RequestKeyValue3=caseobj.asset.HP_Product_Number__c;
            inputAttributeobj.RequestKeyName4='PartOrderId';
            inputAttributeobj.RequestKeyValue4=orderobj.legacy_part_order_number__C;
            objmonitorutility.endMon(inputAttributeobj) ;
        }
    }

    Catch(Exception ex)
    {
        String testATPException=ex.getMessage();
        system.debug('.........testATPException'+testATPException);
        orderobj.Message__c = 'Unable to get availability. TIBCO service is not responding. Please try again.';
        orderobj.Message_Type__c = 'Error';
        orderobj.Pending_Transaction_Type__c = '';
        Saveorder();
        MonitorUtility.MonitorInputAttributes inputAttributeobj=new MonitorUtility.MonitorInputAttributes();
        inputAttributeobj.EndTime=system.now();
        inputAttributeobj.TransactionID=Transactionid;
        inputAttributeobj.Component='SF-PartsOffer-ATP';
        inputAttributeobj.SubComponent='ATP';
        inputAttributeobj.Organization='GSD';
        inputAttributeobj.Source='SFDC';
        inputAttributeobj.EndUser=userInfo.getuserName();
        inputAttributeobj.ResponseBody=testATPException;
        inputAttributeobj.ResponseStatus='400';
        inputAttributeobj.ResponseText ='Fail';
        inputAttributeobj.Domain='FSM';
        inputAttributeobj.RequestKeyName1='Caseid';
        inputAttributeobj.RequestKeyValue1=orderobj.legacy_part_order_number__C.substring(0,10);
        inputAttributeobj.RequestKeyName2='SerialNumber';
        inputAttributeobj.RequestKeyValue2=caseobj.asset.serialnumber;
        inputAttributeobj.RequestKeyName3='ProductNumber';
        inputAttributeobj.RequestKeyValue3=caseobj.asset.HP_Product_Number__c;
        inputAttributeobj.RequestKeyName4='PartOrderId';
        inputAttributeobj.RequestKeyValue4=orderobj.legacy_part_order_number__C;

        objmonitorutility.endMon(inputAttributeobj) ;

    }
}
}
any how i posted the code.

Regards
Lakshman
Bhanu PartapBhanu Partap
when you test exicution begins 
        test.startTest();
        Test.setMock(WebServiceMock.class, new GsdAtpStreamWebMockIml()); 
        POCObj.checkAvail(); // here one callout code performs and check in debug if it is exicuting catch block if yes then code performing DML in Saveorder(); method. so one commited work stands pending.
        POCObj.partlineid=partorderline.id;
        POCObj.checkAvailSupressEqualent(); // now when test exicutes this part if it is performing Callout again then Exception will be thrown.(uncommited work pending).
       test.stopTest();

Please check and verify above anlysis if correct then you can do one thing create another seperate testmethod for Covering this part of Code
POCObj.partlineid=partorderline.id;
POCObj.checkAvailSupressEqualent();
 

then you will not face this problem.