• CallMeHugo
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi all,

We have a lot of data in our Org and I wanted to get started using a Partial Sandbox. The limitation of a partial sandbox is 10,000 records per object and 5GB max. One of our object has over 250,000 records. I would like to know how Salesforce selects the 10,000 records from the 250,000 records to copy to the sandbox. I looked at the data in my Sandbox and it does not seem to be related on the Created Date nor the Modified Date of the original records.

Anyone knows?

Thanks,

Hugo
Hi all,

I have a written a method to allocate MAC addresses based on a custom setting that holds the min, max and current pointer. To make sure I never have duplicates and that the method is atomic, I have use the FOR UPDATE keywords on my query. Now I would like to validate the behaviour using a unit test but I am not able to reproduce multiple queries arriving at the same time to force a collision. Here is some simplified code:

public static String GetMAC() {
   string mac;
   MACAddressBank__c bank = [SELECT CurrentMAC__c FROM MACAddressBank__c FOR UPDATE];
   mac = bank.CurrentMAC__c;
   bank.CurrentMAC__c++;    // Assuming you can do this - for simplicity of the example
   UPDATE bank;
}

//// Test
static testMethod void Test_ValidateCollisionMACBank() {
        INSERT new MACAddressBank__c(Name = 'bank1',  CurrentMAC__c = '0123456789AB' );

   Test.startTest();
   Integer size = 1000;
   // Create asynchhronous requests that will retreive macs at the same time
    RequestMACBatchAsync( MAClist1, size );
    RequestMACBatchAsync( MAClist2, size );
    RequestMACBatchAsync( MAClist3, size );
    RequestMACBatchAsync( MAClist4, size );
   Test.stopTest(); // Wait for async methods to finish

   // Do some logic with asserts and check if all lists contains consecutive MACs
   => Always true, !!! Should not, I want to reproducr collision!

   // Do some logic to check if duplicates exists across each lists
  => Always false, OK
}

static List<String> MAClist1 = new List<String>();
static List<String> MAClist2 = new List<String>();
static List<String> MAClist3 = new List<String>();
static List<String> MAClist4 = new List<String>();

@future
private static void RequestMACBatchAsync( List<String> macs, Integer qty ) {
      while( macs.size() < qty ) {
           macs.add(GetMAC());
      }
    }


So the problem is that I am not able to reproduce two calls to GetMAC at the same time.
I also tried to modify the GetMAC method to retreive a fair amount of MACs at the same time but the test always return consecutive MACs in each lists.

This is a business critical process and major problems can happen if a MAC is duplicated for the end user. I really want to make sure that my lock is working correctly. Any ideas on how I can mock this?

Thanks.
Hi all,

I have a written a method to allocate MAC addresses based on a custom setting that holds the min, max and current pointer. To make sure I never have duplicates and that the method is atomic, I have use the FOR UPDATE keywords on my query. Now I would like to validate the behaviour using a unit test but I am not able to reproduce multiple queries arriving at the same time to force a collision. Here is some simplified code:

public static String GetMAC() {
   string mac;
   MACAddressBank__c bank = [SELECT CurrentMAC__c FROM MACAddressBank__c FOR UPDATE];
   mac = bank.CurrentMAC__c;
   bank.CurrentMAC__c++;    // Assuming you can do this - for simplicity of the example
   UPDATE bank;
}

//// Test
static testMethod void Test_ValidateCollisionMACBank() {
        INSERT new MACAddressBank__c(Name = 'bank1',  CurrentMAC__c = '0123456789AB' );

   Test.startTest();
   Integer size = 1000;
   // Create asynchhronous requests that will retreive macs at the same time
    RequestMACBatchAsync( MAClist1, size );
    RequestMACBatchAsync( MAClist2, size );
    RequestMACBatchAsync( MAClist3, size );
    RequestMACBatchAsync( MAClist4, size );
   Test.stopTest(); // Wait for async methods to finish

   // Do some logic with asserts and check if all lists contains consecutive MACs
   => Always true, !!! Should not, I want to reproducr collision!

   // Do some logic to check if duplicates exists across each lists
  => Always false, OK
}

static List<String> MAClist1 = new List<String>();
static List<String> MAClist2 = new List<String>();
static List<String> MAClist3 = new List<String>();
static List<String> MAClist4 = new List<String>();

@future
private static void RequestMACBatchAsync( List<String> macs, Integer qty ) {
      while( macs.size() < qty ) {
           macs.add(GetMAC());
      }
    }


So the problem is that I am not able to reproduce two calls to GetMAC at the same time.
I also tried to modify the GetMAC method to retreive a fair amount of MACs at the same time but the test always return consecutive MACs in each lists.

This is a business critical process and major problems can happen if a MAC is duplicated for the end user. I really want to make sure that my lock is working correctly. Any ideas on how I can mock this?

Thanks.
Before generating an Enterprise WSDL, I have an option to select a version of installed packages. I want to not include some of the installed packages in my Enterprise WSDL. How can I do that?