• TrUs3Uw3
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 11
    Replies

A Web Tab is created with pointing to some specific URL. It works fantastic in FF as well as in Chrome. But IE don't want to allow me to login. However I can work with this site outside Salesforce pretty good.

I tried to create VF page and put iframe pointed to the same URL - the same situation.

 

Maybe there are any other options to achieve my goal?

My class which perform a callout reads sObject by it's Id and then perform callout with data from this object.

For testing callouts I've created mock using

@isTest
global class Some_Test implements HttpCalloutMock {
	
	global HTTPResponse respond(HTTPRequest req) {
    	HttpResponse response = null;
        //...
response = new HttpResponse(); // set needed information response.setBody('some body goes here'); response.setHeader('Content-Length', response.getBody().length().format()); response.setStatusCode(200); //...
return response; } static { // Set mock callout class Test.setMock(HttpCalloutMock.class, new ATT_WS_Worker_Test()); } public ATT_WS_Worker_Test() { Account account1 = new Account(Name='Account_1'); insert account1; } Account account1 = null; @isTest static void composingRequestTest() { Test.startTest(); // make a callout using account1's Id Test.stopTest(); } }

 As you may understand it will tell me that I'm wrong and I can't perform insert/update before callouts.

 

 

Is there a way to prepare/create data before testing callouts?

 

Regarding Using JavaScript to Reference Components we can get id of a component in JavaScript using

{!$Component.thePanel}

 

Please, imagine that we have next page:

<apex:page >

	<apex:form id="form01">
	
	</apex:form>
	
	<script type="text/javascript">
	
		alert('{!$Component.form01}');
	
	</script>

</apex:page>

 What do you think you will get in alert? Right! bla-bla-bla:form01 And I have it. Nice.

 

Next step.

 

Please, imagine:

<apex:page >

	<apex:form id="form01" >
		<apex:pageBlock id="pageBlock02" >
		</apex:pageBlock>
	</apex:form>
	
	<script type="text/javascript">
	
		alert('{!$Component.pageBlock02}');
	
	</script>

</apex:page>

 What do you think you will get in alert? Right! bla-bla-bla:form01:pageBlock02 

If you have it - you are lucky! I don't.

 

Now remove form tag. - bla-bla-bla:pageBlock02

 

WTH? What am I doing wrong?

I want to se bla-bla-bla:form01:pageBlock02

 

 

 

 

 

 

A Web Tab is created with pointing to some specific URL. It works fantastic in FF as well as in Chrome. But IE don't want to allow me to login. However I can work with this site outside Salesforce pretty good.

I tried to create VF page and put iframe pointed to the same URL - the same situation.

 

Maybe there are any other options to achieve my goal?

i am writing a unit test of a rest service in apex

My Test Class is

global class Feedpost9 {

    // your methods here...

    static testMethod void testRest() {
        // set up the request object
        System.RestContext.request = new RestRequest();
        RestContext.request.requestURI = '/v.9/notifications/preferences/ritesh';
        // Invoke the method directly
        Member__c member=new Member__c(name='ritesh');
        insert member;

        Notification_Settings__c no=new Notification_Settings__c(member__c=member.Id);
         no.Event__c='Category|Cloud Foundry' ;
         no.Event_Per_Member__c='12';
         insert no;


        NotificationRestService.retrievingNotificationSettings();

        RestContext.request.requestURI = '/v.9/notifications/preferences' ;

        NotificationRestService.retrievingNotificationSettings();
        RestContext.request.requestURI ='/v.9/notifications/preferences/ritesh.xml';
NotificationRestService.retrievingNotificationSettings();
    }
}

when test unit reach at this point then i got an error RestContext.request.requestURI = '/v.9/notifications/preferences' ;

        NotificationRestService.retrievingNotificationSettings();

error is

System.NullPointerException: Attempt to de-reference a null object Class.NotificationRestService.retrievingNotificationSettings: line 46, column 1 Class.Feedpost9.testRest: line 23, column 1

and the segment where i am getting this error is

 List<Notification_Settings__c> note1=[SELECT id,name,Member__r.name,Do_not_Notify__c,Event__c,Event_Per_Member__c,Notification_Method__c from Notification_Settings__c WHERE Member__r.name= :userName Limit 1];
Notification_Settings__c note;

if(note1 !=null )
{if(note1.size() >0)
note=note1.get(0);
}

and error is on the line {if(note1.size() >0) i am unable to figure if note1 is not equal to null then it will come to next line but in next line it is giving me error why note1 is null in next linel and passing first if statement.query should return empty list .please someone help!!

 

Hi,

 

when i run the testmethod for webservice class i am getting error message "Methods defined as TestMethod do not support Web service callouts, test skipped".how can i resolve this one

 

Thanks in advance

Hi All,

 

I ma new to salesforce so i don't know how to write test class.

 

can you please tell em how to write test class for below apex class

 

public class AHAccountWrapper{
  public AHAccountWrapper(Boolean radioButton, Account account){
    this.radioButton = radioButton;
    this.account = account;
  }
  public Boolean radioButton{get;set;}
  public Account account{get;set;}
}

Is there a sample code and tutorial as how I can invoke an external webservice from visualforce page or apex code.

I also want to know how I can expose web services within force.com platform so that my external application can invoke that.

 

so basically I need web services inbound and outbound from sfdc. Any tutorials or documentation for that?

 

Thanks,

Kalpana

Regarding Using JavaScript to Reference Components we can get id of a component in JavaScript using

{!$Component.thePanel}

 

Please, imagine that we have next page:

<apex:page >

	<apex:form id="form01">
	
	</apex:form>
	
	<script type="text/javascript">
	
		alert('{!$Component.form01}');
	
	</script>

</apex:page>

 What do you think you will get in alert? Right! bla-bla-bla:form01 And I have it. Nice.

 

Next step.

 

Please, imagine:

<apex:page >

	<apex:form id="form01" >
		<apex:pageBlock id="pageBlock02" >
		</apex:pageBlock>
	</apex:form>
	
	<script type="text/javascript">
	
		alert('{!$Component.pageBlock02}');
	
	</script>

</apex:page>

 What do you think you will get in alert? Right! bla-bla-bla:form01:pageBlock02 

If you have it - you are lucky! I don't.

 

Now remove form tag. - bla-bla-bla:pageBlock02

 

WTH? What am I doing wrong?

I want to se bla-bla-bla:form01:pageBlock02

 

 

 

 

 

 

Hi all,

 

does anyone knows how to activate a contract in a test-class?

 

Thanks,

 

Hannes

  • January 22, 2010
  • Like
  • 1