• Vijay K
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Hello Friends,

I'm unable to get force.com metadata Components from my Org through Eclipses.

Please see the below Error Screen..

User-added image  

Please help me its urgent !!!!!
Thanks advance your help

 
  • May 05, 2015
  • Like
  • 0
Hi All,
P.F.A my controller class and test class.I am unable to increase my code coverage after 60%.
public with sharing class AccountActionsWrapper{
       
    public List<wrapSubscription> SubscriptionSetList{get;set;}
    public integer size{get;set;}
    public String currentDateValue { get; set; }
    public String selectedActions{get;set;}
    public csord__Subscription__c vSub{get;set;}
    public List<csord__Subscription__c> vLstSub{get;set;}
    public Map<Id, List<csord__Subscription__c>> AccIdSubListMap { get; set; }
   
    public Map<Id, List<csord__Service__c>> SubIdServListMap { get; set; }
    Map<Id, csord__Subscription__c> subMap = new Map<Id, csord__Subscription__c>();
    //public List<csord__Service__c> vLstServ{get;set;}
    public boolean AccountBool{get;set;}
    public boolean fals{get;set;}
    public Date SysDate{get;set;}
    public Account vAccount{get;set;}
    public Account vSourceAccount{get;set;}
    public String contextItem{get;set;}
    public integer noOfRecords{get;set;}
    public set<csord__Subscription__c > selectedSubscription;
    public set<id> subids;
    public string accountId;
    public String baseQuery;
    
    //Constructor for the class    
    public AccountActionsWrapper( ){
       
        AccIdSubListMap=new Map<Id, List<csord__Subscription__c>>();
        SubIdServListMap= new Map<Id, List<csord__Service__c>>();
        vSub= new csord__Subscription__c();
        selectedActions='Take Over';
        if(selectedActions=='Take Over'){
            AccountBool=true; 
        }
        fals= false; 
        this.subids = new set<id>();
        this.selectedSubscription = new set<csord__Subscription__c>();
        SubscriptionSetList = new List<wrapSubscription>();
        accountId=ApexPages.currentPage().getParameters().get('id');
        //baseQuery = 'SELECT Name, csord__Status__c,csord__Account__c,MACD_in_progress__c,(select Id,Billing_Account_Number__c from csord__Services__r) FROM csord__Subscription__c where csord__Account__c=:accountId';
        //system.debug('Records &&&&&&'+baseQuery);
    }
        public List<selectOption> ActionValues {
        get {
          List<selectOption> options = new List<selectOption>();
    
          for (csordtelcoa__Change_Types__c cType : csordtelcoa__Change_Types__c.getAll().values())
            options.add(new SelectOption(cType.Name,cType.Name));
          return options;
        }
        set;
      }
    
    //This function implements the pagination logic
    public ApexPages.StandardSetController SubSetController{ 
        
        get{            
            if(SubSetController == null){
                size =20;
                //SubSetController = new ApexPages.StandardSetController(Database.getQueryLocator(baseQuery));
                SubSetController = new ApexPages.StandardSetController([SELECT Name, csord__Status__c,csord__Account__c,MACD_in_progress__c,Billing_Account_Number__c,(select Id,Billing_Account_Number__c from csord__Services__r) FROM csord__Subscription__c where csord__Account__c=:accountId order by Billing_Account_Number__c desc nulls Last]);
                system.debug('Return Records $$$$$$$$'+SubSetController);            
                this.SubSetController.setpageNumber(1);               
                this.SubSetController.setPageSize(size);
                noOfRecords = SubSetController.getResultSize(); 
            }
            return SubSetController;
          }set;
     }
     
     //The following function is used for retrieving different picklist value from Action field
    public List<SelectOption> getActions( ){ 
        List<SelectOption> Actions= new List<SelectOption>();
        Actions.add(new SelectOption('Take Over','Take Over'));
        Actions.add(new SelectOption('Invoice Switch','Invoice Switch'));
        Actions.add(new SelectOption('Move','Move'));
        return Actions;
     }
     
     
     //Below logic is used for enable/disable of Target Account field based on Action field value
    public void getDisplayAccount( ){
        if(selectedActions!='Take Over'){
            AccountBool=false; 
        }
        else{
            AccountBool=true;
        }
    }
    
    //Following function implements wrapper logic 
    public List<wrapSubscription> getCurrentList( ){        
        updateSelectedSubscriptions();
        SubscriptionSetList = new List<wrapSubscription>();
        for (csord__Subscription__c vSubscription : (List<csord__Subscription__c >)SubSetController.getRecords( )){
            system.debug('vSubscription @@@@@@@@@ '+vSubscription);
            if(selectedSubscription.contains(vSubscription))
                SubscriptionSetList.add(new wrapSubscription(vSubscription,'true'));
            else
                SubscriptionSetList.add(new wrapSubscription(vSubscription));
                system.debug('SubscriptionSetList########'+SubscriptionSetList);
        }  
        fals=false;       
        return SubscriptionSetList;
    }
    
   //This method update the selected Subscriptions List in the wrapper Class
    public void updateSelectedSubscriptions( ){
        for(wrapSubscription cs: SubscriptionSetList){
            if(cs.selected)
                selectedSubscription.add(cs.vSub);
            else
            {
                if(selectedSubscription.contains(cs.vSub))
                selectedSubscription.remove(cs.vSub);
                
            }
            
        }
    }
    
    //This method adding the selected subscriptions to the list
    public void doSelectItem( ){        
        if(contextItem!=null)
            this.subids.add(this.contextItem);        
    }
    
    //This method remove the deselected subscriptions to the list
    public void doDeselectItem( ){      
        this.subids.remove(this.contextItem);        
    }
     
    //This method count the selected subscriptions
    public Integer getSelectedCount( ){       
        subids.clear();
        for(csord__Subscription__c acc: selectedSubscription){
            subids.add(acc.id);
        }
        return this.subids.size();       
    }
     
    //Below method implements the Next button logic for pagination
    public void doNext( ){       
        if(this.SubSetController.getHasNext())
            this.SubSetController.next();       
    }
    
    
    //Below method for the Previous button logic for pagination
     public void doPrevious( ){       
        if(this.SubSetController.getHasPrevious())
            this.SubSetController.previous();        
    }
     
    public Boolean getHasPrevious( ){       
        return this.SubSetController.getHasPrevious();        
    }
       
       
    //Below method implements the Next button logic for pagination   
    public Boolean getHasNext( ){      
        return this.SubSetController.getHasNext();        
    }
       
       
    //Following method returns the current page number in pagination logic  
    public Integer getPageNumber( ){       
        return this.SubSetController.getPageNumber();        
    }
       
       
    //Following function implements the total pages number  
    public Integer getTotalPages( ){       
        Decimal totalSize = this.SubSetController.getResultSize();
        Decimal pageSize = this.SubSetController.getPageSize();       
        Decimal pages = totalSize/pageSize;       
        return (Integer)pages.round(System.RoundingMode.CEILING);
    } 
       
    //Below method has logic for Cancel button used in pagination       
    public PageReference cancel( ){
        return new PageReference('/'+accountid);
    }       
      
      
    //Following function will perform the validations behind the Continue button& restrict an user to proceed to next page if any of the validation fails.Also invokes the method provided by CS Team.
    public pageReference Proceed( ){
        SysDate = System.today();
        accountId=ApexPages.currentPage().getParameters().get('id');
        if(vSub.csord__Account__c!= null){
            vAccount=[Select Name,TINA_Parent_Cust_Number__c,TfB_PB_CreditCheckExpiryDate__c,TfB_PB_CreditCheckResponse__c from Account where Id=:vSub.csord__Account__c];  
        }   
             //Venkat added the below logic
        vSourceAccount = [Select Name,TINA_Parent_Cust_Number__c,TfB_PB_CreditCheckExpiryDate__c,TfB_PB_CreditCheckResponse__c from Account where Id=:accountId];
        if(selectedActions =='Take Over'){
            if(vSub.csord__Account__c==null){ 
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please select The Target Account');
                ApexPages.addMessage(myMsg);            
                return null;          
            }  
                   
                    
            if(vSub.csord__Account__c==accountId){ 
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The target account is the same as the current account, it has to be different.');
                ApexPages.addMessage(myMsg);            
                return null; 
            }
                       
            if(vAccount.TfB_PB_CreditCheckExpiryDate__c== null){                                                                     
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The credit check for this account is missing an expiry date, you need to do another credit check before entering the Takeover order.');
                ApexPages.addMessage(myMsg);            
                return null;                                 
            }
                                  
            if(vAccount.TfB_PB_CreditCheckExpiryDate__c <= SysDate){                                                              
                system.debug('Negative Else1----');                                      
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The Credit Check results have reached the expiry date. Please perform the Credit Check from the account before performing Order');
                ApexPages.addMessage(myMsg);            
                return null;                       
            } 
            
            if(vAccount.TfB_PB_CreditCheckResponse__c == 'Positive' || vAccount.TfB_PB_CreditCheckResponse__c == 'ERROR'){                        
                if(subids.size()>0){
                    pageReference pr = new PageReference('/apex/StatusPage');
                    return pr;
                }
                else{
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'You need to select atleast one subscription');
                    ApexPages.addMessage(myMsg);            
                    return null; 
                    }   
            }
            
            if(vAccount.TfB_PB_CreditCheckResponse__c == 'Negative-1'){                                                                          
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'You cannot proceed with Order Intake since the customer has a negative credit check -1');
                ApexPages.addMessage(myMsg);            
                return null;
            }
            
            if(vAccount.TfB_PB_CreditCheckResponse__c == 'Negative-2'){
                system.debug('Negative----');
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'You cannot proceed with Order Intake since the customer has a negative credit check -2');
                ApexPages.addMessage(myMsg);            
                return null;                             
            }
            
            if(vAccount.TfB_PB_CreditCheckResponse__c == null || vAccount.TfB_PB_CreditCheckResponse__c!='POSITIVE' ||vAccount.TfB_PB_CreditCheckResponse__c!='NEGATIVE-1'||vAccount.TfB_PB_CreditCheckResponse__c!='NEGATIVE-2'||vAccount.TfB_PB_CreditCheckResponse__c!='ERROR' ){
                system.debug('Negative Else----');
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The account does not have a positive credit check, you need to get an approval to continue with the order');
                ApexPages.addMessage(myMsg);            
                return null;                                           
            }                                  
            return null;                              
        }                                                                                
        else if(selectedActions =='Move'){
            if(vSourceAccount.TfB_PB_CreditCheckExpiryDate__c== null){                            
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The credit check for this account is missing an expiry date, you need to do another credit check before entering the Takeover order.');
                ApexPages.addMessage(myMsg);            
                return null;                                 
            }
            
            if(vSourceAccount.TfB_PB_CreditCheckExpiryDate__c <= SysDate){
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The Credit Check results have reached the expiry date. Please perform the Credit Check from the account before performing Order');
                ApexPages.addMessage(myMsg);            
                return null;                       
            }  
            
            if(vSourceAccount.TfB_PB_CreditCheckResponse__c == 'Positive'|| vSourceAccount.TfB_PB_CreditCheckResponse__c == 'ERROR'){                      
                if(subids.size()>0){
                    pageReference pr = new PageReference('/apex/StatusPage');
                    return pr;
                }
                else{
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'You need to select atleast one subscription');
                    ApexPages.addMessage(myMsg);            
                    return null; 
                }   
            }
            
            if(vSourceAccount.TfB_PB_CreditCheckResponse__c == 'Negative-1'){
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'You cannot proceed with Order Intake since the customer has a negative credit check -1');
                ApexPages.addMessage(myMsg);            
                return null;
            }
            if(vSourceAccount.TfB_PB_CreditCheckResponse__c == 'Negative-2'){
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'You cannot proceed with Order Intake since the customer has a negative credit check -2');
                ApexPages.addMessage(myMsg);            
                return null;                             
            }
            if(vSourceAccount.TfB_PB_CreditCheckResponse__c == null || vSourceAccount.TfB_PB_CreditCheckResponse__c!='POSITIVE' ||vSourceAccount.TfB_PB_CreditCheckResponse__c!='NEGATIVE-1'||vSourceAccount.TfB_PB_CreditCheckResponse__c!='NEGATIVE-2'||vSourceAccount.TfB_PB_CreditCheckResponse__c!='ERROR' ){
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The account does not have a positive credit check, you need to get an approval to continue with the order');
                ApexPages.addMessage(myMsg);            
                return null;                                           
            } 
            return null; 
        }                                                                                                                                                                                                                                
            else{
                if(subids.size()>0){
                    pageReference pr = new PageReference('/apex/StatusPage');
                    return pr;
                }
                else{
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'You need to select atleast one subscription');
                    ApexPages.addMessage(myMsg);            
                    return null; 
                }        
                 
            } 
    }        
    
    //Wrapper class logic      
    public class wrapSubscription{
        public csord__Subscription__c vSub {get; set;}        
        public Boolean selected {get; set;}
        //public List<csord__Service__c> vServ{get;set;}
        //public List<csord__Service__c> Serv{get;set;}
        public wrapSubscription( ){
            vSub = new csord__Subscription__c();
            selected = false;
        }
        public wrapSubscription(csord__Subscription__c a){
            vSub = a;
            selected = false;
        }
        public wrapSubscription(csord__Subscription__c c,string s){
            vSub=c;
            selected=true;
        }       
        
    }
}
@isTest(seeAlldata=true)
public class TfB_PB_TestAccountActionsWrapper
{
    public static testMethod void myUnitTest() 
    { 
        PageReference pg = Page.TfB_PB_AccountActionsVf;
        Test.setCurrentPage(pg); 
        Account SourceAcc = new Account(Name='Test1',C_fe_Customer_Number__c='6548681',TfB_PB_CreditCheckResponse__c='Positive');
        insert SourceAcc;   
        csord__Order_Request__c vOrderReq = new csord__Order_Request__c();
        vOrderReq.Name='Test Order';
        vOrderReq.csord__Module_Name__c='TestModule';
        vOrderReq.csord__Module_Version__c='TestVersion';
        vOrderReq.TfB_PB_Account__c=SourceAcc.Id;
        insert vOrderReq;
    
        csord__Subscription__c  objCS = new csord__Subscription__c (csord__Account__c = SourceAcc.Id,csord__Order_Request__c=vOrderReq.Id,csord__Identification__c='abc',Name= 'test');
        insert objCS;
    
        TfB_PB_AccountActionsWrapper objActWap = new TfB_PB_AccountActionsWrapper();
        ApexPages.currentPage().getParameters().put('id',SourceAcc.Id);
        objActWap.selectedActions='Move';
        objActWap.Proceed();
        objActWap.getActions();
        objActWap.getDisplayAccount();
        objActWap.getCurrentList();
        objActWap.updateSelectedSubscriptions();
        objActWap.doSelectItem();
        objActWap.doDeselectItem();
        objActWap.getSelectedCount();
        objActWap.doNext();
        objActWap.doPrevious();
        objActWap.getHasPrevious();
        objActWap.getHasNext();
        objActWap.cancel();
        objActWap.getTotalPages();
        objActWap.getPageNumber();
        
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper = new TfB_PB_AccountActionsWrapper.wrapSubscription(); 
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper1 = new TfB_PB_AccountActionsWrapper.wrapSubscription(objCS);
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper2 = new TfB_PB_AccountActionsWrapper.wrapSubscription(objCS,'True');
    }
    public static testMethod void myUnitTest1() 
    { 
        PageReference pg = Page.TfB_PB_AccountActionsVf;
        Test.setCurrentPage(pg); 
        Account SourceAcc = new Account(Name='Test1',C_fe_Customer_Number__c='6590681',TfB_PB_CreditCheckExpiryDate__c=system.today()-1);
        insert SourceAcc;   
        csord__Order_Request__c vOrderReq = new csord__Order_Request__c();
        vOrderReq.Name='Test Order';
        vOrderReq.csord__Module_Name__c='TestModule';
        vOrderReq.csord__Module_Version__c='TestVersion';
        vOrderReq.TfB_PB_Account__c=SourceAcc.Id;
        insert vOrderReq;
    
        csord__Subscription__c  objCS = new csord__Subscription__c (csord__Account__c = SourceAcc.Id,csord__Order_Request__c=vOrderReq.Id,csord__Identification__c='abc',Name= 'test');
        insert objCS;
    
        TfB_PB_AccountActionsWrapper objActWap = new TfB_PB_AccountActionsWrapper();
        ApexPages.currentPage().getParameters().put('id',SourceAcc.Id);
        objActWap.selectedActions='Move';
        objActWap.Proceed();
               
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper = new TfB_PB_AccountActionsWrapper.wrapSubscription(); 
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper1 = new TfB_PB_AccountActionsWrapper.wrapSubscription(objCS);
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper2 = new TfB_PB_AccountActionsWrapper.wrapSubscription(objCS,'True');
    }
    public static testMethod void myUnitTest2() 
    { 
        PageReference pg = Page.TfB_PB_AccountActionsVf;
        Test.setCurrentPage(pg); 
        Account SourceAcc = new Account(Name='Test2',C_fe_Customer_Number__c='738745936',TfB_PB_CreditCheckResponse__c='Negative-1');
        insert SourceAcc;   
        csord__Order_Request__c vOrderReq = new csord__Order_Request__c();
        vOrderReq.Name='Test Order';
        vOrderReq.csord__Module_Name__c='TestModule';
        vOrderReq.csord__Module_Version__c='TestVersion';
        vOrderReq.TfB_PB_Account__c=SourceAcc.Id;
        insert vOrderReq;
    
        csord__Subscription__c  objCS = new csord__Subscription__c (csord__Account__c = SourceAcc.Id,csord__Order_Request__c=vOrderReq.Id,csord__Identification__c='abc',Name= 'test');
        insert objCS;
    
        TfB_PB_AccountActionsWrapper objActWap = new TfB_PB_AccountActionsWrapper();
        ApexPages.currentPage().getParameters().put('id',SourceAcc.Id);
        objActWap.selectedActions='Move';
        objActWap.Proceed();
               
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper = new TfB_PB_AccountActionsWrapper.wrapSubscription(); 
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper1 = new TfB_PB_AccountActionsWrapper.wrapSubscription(objCS);
         TfB_PB_AccountActionsWrapper.wrapSubscription AccWrapper2 = new TfB_PB_AccountActionsWrapper.wrapSubscription(objCS,'True');
    }
    
    
}
Whenver i am covering one if case lets say Suppose i am covering if condition for "Positive" for Take Over scenario(refer above code),then Negative-1 or Negative-2 code become uncovered and vice cersa.I am not able to increase after 605 after so many try.
Ply help me on this.

Mnay thanks in advance.