The wrong REST endpoint gets executed - jira

I am using a REST endpoint and the wrong code gets executed as you can see here in the following screenshot: 
How can I specify the right code to be executed, I don't want codeFound by class scanning and can't be edited here as shown in the screenshot 

Related

Vaadin23 vaadin.eagerServerLoad=true and BeforeEnterObserver

I switched to vaadin.eagerServerLoad=true in order to fix the issue with incorrect HTTP status code (I need to return 404 when it is needed).
I also noticed one issue which potentially maybe related to the vaadin.eagerServerLoad=true. On the views with com.vaadin.flow.router.BeforeEnterObserver the method BeforeEnterObserver.beforeEnter is executed twice when I for the very first time enter the page (please note that there is no such issue when I navigate between views in the already constructed UI). This is why now as a temporal fix I have to call removeAll() as a first line in the beforeEnter method.
What am I doing wrong and how to fix it?

ADO API: Builds-List incomplete list

I'm calling this API method:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-6.0#response
My API url (with placeholder names):
https://dev.azure.com/MyOrgName/MyProjName/_apis/build/builds?api-version=6.1-preview.6
The results are mostly appropriate, except I get a filtered list of builds, and I can't seem to get all the builds I want. In particular, builds from several pipelines are simply missing, and I can't find any way to include them. There's no discernable reason why some builds are included, and some are not.
The filter options describe ways I could reduce it more, but that's not my goal. I want to retrieve builds which I am otherwise not getting. And I don't know what option that I don't know about which will get me the results I care about.
As you have already noticed, there is a maximum number of the objects that can be listed on the response body of each API call. Normally, if the objects you want to list are too many, they will be returned in multiple pages.
In the response body of each call, generally there is a parameter 'continuationToken' (see here). You can access the next response page via calling the API with this parameter.
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds?continuationToken={continuationToken}&api-version=6.1-preview.6
For example:
the first call returns the list in the first page;
then run the second call with the parameter 'continuationToken' returned in the response of the first call to get the second page;
then get the third page using the 'continuationToken' returned in the second response;
. . .
until the last page.
If you want to traverse all the pages, you may need to call the API in a loop.

Skip "Capture Page Screenshot" for some keywords

I'm writing test cases in Robot Framework using AppiumLibrary.
I'm importing AppiumLibrary with the following code to get a screenshot whenever something goes wrong:
AppiumLibrary.__init__(self, run_on_failure="Capture Page Screenshot")
Is there a way to NOT take a screenshot for a specific keyword? This keyword will for example create 15 screenshots (if it's not able to find Donald):
Wait Until Keyword Succeeds 30 seconds 2 seconds Element Text Should Be Username Donald
There is nothing built-in to do what you want. There are many solutions, however.
One solution would be to turn off capturing the keyword (using register keyword to run on failure) immediately before calling wait until keyword succeeds. You could then call wait until keyword succeeds, and then turn capturing back on afterwards.
Or, you can register your own custom keyword instead of Capture page screenshot. Your own keyword can use whatever logic it wants to determine whether to capture screenshots or not. For example, it could look for a global variable that tells it whether to capture or not.
You could also write your own keyword to use in place of wait until keyword succeeds which also uses one of the other two solutions.
For example, create a keyword named wait until element contains text which turns off the capturing, runs wait until keyword succeeds, and then turns it back on. Then, in your test you still just have a single statement:
wait until element contains text Username Donald
Register Keyword To Run On Failure NONE
${Status} Run Keyword And Return Status Wait Until Keyword Succeeds 30 seconds 2 seconds Element Text Should Be Username Donald
Register Keyword To Run On Failure Capture Page Screenshot
IF ${Status}==False
Element Text Should Be Username Donald
END
-Lets Walkthrough whats happening in the above code snippet
Register Keyword To Run On Failure NONE (To avoid multiple
screenshots when Element Text Should Be keyword fails in the
next line )
After waiting for 30 seconds it will return status If the keyword passes it returns pass and if it fails it returns fails and gets stored in status variable (Remember no screenshots are generated in this process since we turned off screenshots in point 1.)
Again setting back Capture Page Screenshot Keyword on Failure to take screenshot.
Lastly one more time it will run Element Text Should Be and if it fails it generates a screenshot and keyword fails.(Since ${Status}==False that means it will run only if Wait Until Keyword Succeeds keyword fails otherwise this IF block will not run since our keyword already passed)

How to properly save updates to domain objects in Groovy/Grails

I'm starting to touch the Groovy/Grails backend of my organization and am tasked with updating the User on our Document domain object. The problem is, after hitting the update endpoint from the frontend with the correct params attached, the backend responds with an unchanged Document object.
Here is the code:
if (requestParams.userEmail) {
def contact = User.findByEmail(requestParams.userEmail)
log.debug('Reading user found by passed email contact={} error={}',contact, contact.errors.allErrors.inspect())
if (!contact) {
response.status = 400
render WebserviceError.badInput as JSON
return
}
document.user = contact
document.user.save(flush: true)
}
document.save(flush: true)
render survey as JSON
The frontend returns a promise and I'm logging the promise response, and it shows an unchanged Document object with the same exact user attached. I don't receive a 400 so it looks like the contact is successfully found.
I tried adding flush:true to the user.save call and the document.save call and that did not help.
Are there any obvious wrongdoings in my code?
Well db operations should be in a service, not in a controller, using #Transactional, preferably the gorm version not the spring version. You shouldn't need to use flush: true. Then fron the service you can return to the controller, andrender as JSON.
You don’t state that you see the debug statement on the server indicating a found user, perhaps it’s never actually getting to this section?
I assume that the code provided is incomplete, as we don’t see that the survey being returned contains the document that’s being updated. And also the braces look unbalanced, as if there’s a control flow issue. (i.e. why are there 2 opening braces but 3 closing braces?)
I’d suggest that you use a debugger on your code to see how control is actually flowing. Most Java IDEs support easy debugging, essentially clicking the debug button rather than the run button. Set a number of breakpoints sprinkled through this code to catch requests and call the API endpoint from your frontend.
is Document the parent? User a child?
User.addTodocument(someUser)
then Document.merge()

How to get the current task dynaform in Process Maker?

I am new to working with process maker and I cannot figure out how to get the form for the current task in a process using the GET /cases/{app_uid}/current-task. I am able to create new cases using POST /cases, which go in the draft. I am also able to route those cases and put them in inbox using the /cases/{{app_uid}}/route-case. I can also figure out the variables using the process-variables API endpoint. But I cannot tell which variable is needed by the current task and how to get the options for it.
Is someone aware of this? How to get the dynaform for the current task?
You can use the Designer REST API to find the steps that are part of a given task. In particular, you might be interested in the /steps endpoint. Once you know the steps of a given task (including any dynaforms), you can get the information of the corresponding dynaform with the /dynaforms endpoint, which includes the definition of all Dynaform fields.
You can achieve this through the following steps:
First get the task UID and then call the REST Endpoint /api/1.0/{workspace}/project/{project UID}/activity/{Task UID}/steps to get all the steps for that task.
Iterate through the steps to get the UID of the first dynaform which is stored in step_uid_obj.
To access the Dynaform call the REST Endpoint /api/1.0/{workspace}/project/{project UID}/dynaform/{dynaform UID}. It returns a json object for the dynaform which stores all the properties of the dynaform and the fields.
In order to access the variables you can call the following REST Endpoint, which returns all the variables for that project.
/api/1.0/{workspace}/cases/{application UID}/variables

Resources