• grcj
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hi,

 

While I'm testing my custom controllers, I've encountered some problems with save points.

 

My test code calls several methods to create test data, and some of the methods contains code like bellow:

 

 

 

public void save()
{
    Savepoint sp = Database.setSavepoint();
        
    try {
        // delete and insert operations comes here

    } catch (Exception e) {
        Database.rollback(sp);
        throw e;
    }
}


 

 

After preparing the data, I tried to test one of my method which also contains save point, and the test fails because of the following error:

 

System.LimitException: Too many save points: 6

 

I thought I had to reduce the number of save points by explicitly discarding them or committing the data, but I couldn't find how to do so.

 

Could anybody help me on how to solve this problem?

 

This is problematic only in test code so far as I don't need to call those methods in series in other places.

 

Thanks and best regards,

 

grcj

  • December 07, 2010
  • Like
  • 0

Hi,

 

I am creating a VF page with custom stylesheets ( <apex:page standardStylesheets="false">)

I'm trying to create an registration form which updates my custom object.

 

 

<apex:page sidebar="false" standardStylesheets="false" showHeader="false" controller="MyObjectController">
<head>
<apex:stylesheet value="{!URLFOR($Resource.common, 'common/css/mystyles.css')}"/>
</head>
<body>

<apex:form id="registrationForm">

<table>
<tr>
<th>Name<span class="important">*</span></th>
<td><apex:inputText value="{!myObj.Name}" size="40" maxlength="120" styleClass="input-m"/></td>
</tr>
<tr>
<th>Start date<span class="important">*</span></th>
<td><!--apex:inputField value="{!myObj.start_date__c}" styleClass="input-m"/--></td>
</tr>
</table>

....

 

Everything works fine until I include <apex:InputField> tag with Date type custom field (commented out in the code above).

However, once I uncomment the inputField with myObj.start_date__c (Date type field), my custom styles seemed to be overwritten and styles got messed up.

Seems like when I include Date type field, "common.css" got loaded and override the styles.

 

What is the best way to avoid this problem?

Is there any way to disable loading default stylesheets with Date type inputField?

 

Thanks and best regards,

 

 

  • August 17, 2010
  • Like
  • 0

Hi,

 

While I'm testing my custom controllers, I've encountered some problems with save points.

 

My test code calls several methods to create test data, and some of the methods contains code like bellow:

 

 

 

public void save()
{
    Savepoint sp = Database.setSavepoint();
        
    try {
        // delete and insert operations comes here

    } catch (Exception e) {
        Database.rollback(sp);
        throw e;
    }
}


 

 

After preparing the data, I tried to test one of my method which also contains save point, and the test fails because of the following error:

 

System.LimitException: Too many save points: 6

 

I thought I had to reduce the number of save points by explicitly discarding them or committing the data, but I couldn't find how to do so.

 

Could anybody help me on how to solve this problem?

 

This is problematic only in test code so far as I don't need to call those methods in series in other places.

 

Thanks and best regards,

 

grcj

  • December 07, 2010
  • Like
  • 0

Hi,

 

I am creating a VF page with custom stylesheets ( <apex:page standardStylesheets="false">)

I'm trying to create an registration form which updates my custom object.

 

 

<apex:page sidebar="false" standardStylesheets="false" showHeader="false" controller="MyObjectController">
<head>
<apex:stylesheet value="{!URLFOR($Resource.common, 'common/css/mystyles.css')}"/>
</head>
<body>

<apex:form id="registrationForm">

<table>
<tr>
<th>Name<span class="important">*</span></th>
<td><apex:inputText value="{!myObj.Name}" size="40" maxlength="120" styleClass="input-m"/></td>
</tr>
<tr>
<th>Start date<span class="important">*</span></th>
<td><!--apex:inputField value="{!myObj.start_date__c}" styleClass="input-m"/--></td>
</tr>
</table>

....

 

Everything works fine until I include <apex:InputField> tag with Date type custom field (commented out in the code above).

However, once I uncomment the inputField with myObj.start_date__c (Date type field), my custom styles seemed to be overwritten and styles got messed up.

Seems like when I include Date type field, "common.css" got loaded and override the styles.

 

What is the best way to avoid this problem?

Is there any way to disable loading default stylesheets with Date type inputField?

 

Thanks and best regards,

 

 

  • August 17, 2010
  • Like
  • 0