4

I am attempting to install the custom metadata loader into production.

Per this issue on the github repo, I'm running into a null pointer exception. I am installing the new version, under the forcedotcom repo.

I have tried installing via the 'deploy to salesforce' button as well as by using workbench, and encounter errors with either.

In workbench, I tried running only one local tests, and all local tests.

Running one local test failed due to what appeared to me to be code coverage issues on the customMetadataLoader classes.

Running all local tests caused the exact same test failure as listed in the gitHub issue.

While at this point I could probably manually load the 100 metadata records faster, I would appreciate any tips on anything else to try. Or if anyone can figure out what the issue is with the test and get it sorted out that would be great too.

FWIW the class that appears to be throwing the error was generated by wsdl2apex. I feel like there was a thread on that recently.

1 Answer 1

5

The problem is occurring in the upsertMetadata SOAP callout in a testing context.

The test Cases in CustomMetadataUploadControllerTest are using the MDWrapperWebServiceMock mock for the SOAP requests. However, these aren't mocking a response for upsertMetadata_element. As such it is returning a null response, which then breaks on response_x.result on line 9274.

Updating the MDWrapperWebServiceMock doInvoke method to include the following is sufficient to get the test case passing again.

else if (responseType == 'MetadataService.upsertMetadataResponse_element') {
    MetadataService.upsertMetadataResponse_element respElt = new MetadataService.upsertMetadataResponse_element();
    response.put('response_x', respElt);            
}

I created a pull request to get the fix applied.

1
  • 2
    Pull request has been merged, so this should be working now. Thanks to Daniel for finding and fixing the problem. Commented Dec 7, 2016 at 16:22

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.