Is there an example on how to mock a subject and roles in junit? I would like to mock the subject with a specific set of roles. This link doesn't explain how to accomplish this task. Thanks
The 'Unit Testing' section of the linked page shows how to create mocks. See the ExampleShiroUnitTest code sample using EasyMock.
You would have to mock subject.hasRole calls:
expect(subject.hasRole(eq("aRoleName")).andReturn(true);
Related
I've added some custom fields for Test Plan in Azure DevOps. But when I try to create a new Test Plan through the Rest API call, it is only creating a Test Plan with default fields populated, while custom fields remain blank.
I've tried using both the field name (like Team Name) along with field reference name (like custom.TeamName) but to no avail. Even Get is also not exposing custom fields. Is some extra configuration required for custom fields, or it is a code related issue?
Details: I've created one Inherited process under the organization, and then under Process->Test Plan I've created new fields in the Test Plan, as shown in the screen shot:
I've tried below code to create Test Plan as Work Item and successfully created it with extra fields. But as I couldn't create a test suite independently, it is not behaving properly.
I've created a JsonPatchDocument and added all the fields (adding just one here) like below code:
JsonPatchDocument patchDocument= new JsonPatchDocument();
patchDocument.Add(
{
Operation=Operation.Add,
Path="/fields/System.TeamName",
Value="Xander"
}
);
VssConnection connection=new VssConnection(uri,credential);
WorkItemTrackingHttpClient workItemTrackingHttpClient= connection.GetClient<WorkItemTrackingHTTPClient>();
WorkItem res=workItemTrackingHTTPClient.CreateWorkItemAsync(patchDocument,project,"Test Plan").Result;
It is creating the Test Plan, but not Test Suite. So it is acting weirdly. Kindly check this.
Insert value into Azure DevOps Custom Fields through Rest Api
I could reproduce this issue with the REST API Test Plans - Create.
I think this should be related to the REST API, that because even if I use the REST API Test Plans - Get to get the custom field, but the request body does not include the custom field.
Since we could not get the custom field, we could not use the POST or PATCH for the custom filed.
You could add this request for this feature on our UserVoice site (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ), which is our main forum for product suggestions. Thank you for helping us build a better Azure DevOps.
i try to deploy the DocuSign solution on Salesforce,
i have generated the DocuSign Class by wsdl2apex to use the SOAP API
is there a solution to code coverage the generated class ?
is the Test class exist somewhere ?
Did i miss something in the Docusign for salesforce package ?
(maybe the Soap API is included)
Thx
Found nothing better than a boring code coverage class
https://support-avenirgreen.my.salesforce.com/sfc/p/0Y000000ZhQt/a/1v000000qbVS/i3eR2apM93hqUrANrQdGoh3R_KXEPEiCoj3owHiRB_A
https://support-avenirgreen.my.salesforce.com/sfc/p/0Y000000ZhQt/a/1v000000qbVX/IqQHhlha3IBcAVjNJcudpXc2VwS63f.BFQq.um.ZZF4
I'm developing REST API. There is'Users' and 'Tasks'resources and each user is able to create 'UserTask'. So, what kind of URL is in line with REST API standards and conventions? Wich approach is more logical In the end?
post: users/{id}/tasks
or
post: tasks/users/{id}
does it make sense to have both?
I have read lots of topics about it but found nothing that could be helpful in this particular case.
If a task belongs to a particular user, I would go for:
POST /users/{user-id}/tasks
To get a representation of a particular task, you could use:
GET /users/{user-id}/tasks/{task-id}
If you might consider Object orient philosophy, Then user will perform task and not task have users.
So you can consider using this : post: users/{id}/tasks.
I try to write a service module, that fetches userdata from a webservice. I found this tutorial, but it shows the 'old' way of building extensions. Is it possible to write a extbase-extension like this? How it should look like?
Extbase ("the new way") is about MVC, not about auth services, thus this tutorial is still valid.
Claus Due (an Extbase specialist) wrote an auth extension, maybe you want to study his code: https://github.com/NamelessCoder/google_auth
I have created an email service in force.com.Can anyone help me out of how to use thta in apex classes.say,i wanna send mail when user registration is successful??
Many Thanks,
Sandhya Krishnan
I assume you want to send an email directly from Apex code, either in a Trigger or from a page controller ... ? If so, this page can get you started:
http://www.forcetree.com/2009/07/sending-email-from-your-apex-class.html
Clearly you don't want to hard-code your email template into your classes, so make sure to read at least through the part that shows how to look up the template dynamically. That should be enough to get you on your way.