I'm using the WL.Device.Geo API. actually, only the WL.Device.Geo.acquirePosition. method documented here: http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fapiref%2Fr_wl_location_geoAcquirePosition.html
For the onSuccess method it states:
A callback function that is invoked when a position is acquired
successfully. The position is passed as a parameter to the callback
function.
Is it documented anywhere the parameters that are passed to the callback function? I can use, for example, the JSON.stringify method for getting the content but this situation is something I have faced more times with the API documentation and I do not know whether or not is it documented, or if there is more detailed API documentation.
The callback receives a W3C position object (http://www.w3.org/TR/geolocation-API/#position_interface). The timestamp is always the number of milliseconds elapsed since Jan 1, 1970 (the W3C specifies the use of DOMTimestamp - on some platforms this is implemented as the number of milliseconds elapsed, on others it is a Date object. WL.Device.Geo.acquirePosition and updates to the device context when using WL.Device.startAcquisition always use the former).
Related
Looking at the MDN documentation IOS/Safari fully supports ServiceWorkerGlobalScope.onfetch but when you look at the FetchEvent specification it says it is not supported at all by Safari.
In particular, I would like to store some state for each client and was hoping to use the fetchEvent.clientId property of the event to index it. Of course I presume I also have access to the fetchEvent.request object otherwise I can't see how a service worker can do anything useful and I could simulate clientID from a passed in parameter in the url. But the docs don't really tell me what IOS/Safari supports and doesn't so I don't know which way to go.
Can someone please tell me precisely what does IOS/Safari pass when it calls the defined onfetch function.
I found the answer to my question by using https://jakearchibald.github.io/isserviceworkerready/demos/fetchevent/
connecting my iPad to my Macbook and debugging my iPad. I was eventually able to open the web inspector for the Service worker for that page, and the console.log showed the event passed in.
FetchEvent.clientID is present but a zero length string. As it happens I did the same thing on my (linux) Desktop using Chrome and its also a zero length string, BUT it has another parameter resultingClientId with what looks like a UUID in it. That parameter is not there in Safari.
The FetchEvent.request is there, and in particular the URL. So I can generate my own client id in the client (I am using Date.now().toString() as that is good enough for my purposes) for use in the service worker. In fact my site without a service worker was using the in the URLs I need to intercept already, so I am happy that I have a solution.
I have two Threads running in parallel, one responsible for the load testing, the other for generating Authentication token.
The problems I have are in this section:
enter image description here
Two if controllers checking basically the current time with the jmeter function ${__time(/1000,)}.
If the time + {delay time for next request} < current time = > time =current time and make request for the auth token.
The other controller's purpose is making the thread "sleep" for 30 seconds.
My problem is that it seems the if statement is executed only once and can not enter this if() and update my time property, hence only 1 token is requested and after time it will expire.
Do you have any idea why this if() statement is executed only once /Thread is infinite/ and how can I check for the current time ?
It is not very possible to come up with the comprehensive solution without seeing your If Controllers conditions, so far I can only suggest checking all the variables and expressions using Debug Sampler and View Results Tree listener combination (including the functions used in the If Controllers)
Also be aware that
starting from JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting
it is NOT recommended to reference JMeter Functions and/or Variables like ${__time(/1000,)} in Beanshell/Groovy scripts
How to get from api information shown in the picture?
I have the connection to api, and I couldn't find in api documentation, the method to get this event details.
thank you.
You need the event.get method. See this page in the Zabbix manual: https://www.zabbix.com/documentation/3.0/manual/api/reference/event/get
Specifically, you probably need the second example, "Retrieving events by time period".
If you want to get trigger names, use the selectRelatedObject flag. As the default source is triggers, you should not get discovery, internal and auto-registration events.
If you really use the old 1.8 version, the flag for trigger names is select_triggers - see https://www.zabbix.com/documentation/1.8/api/event/get .
The following is the method I am trying to use for getting the API to make the calls to Google calendar. I am not sure what the stub should return. Should I capture the normal response and use it as is or is there a reference with minimum set of parameters?
api = client.discovered_api('calendar', 'v3')
result = client.execute!(:api_method => api.calendar_list.list)
I can see that Omniauth provides it's own mock support and I can see that Google provides Python mock libraries, but I'm not aware of any direct Google support for mocking from Ruby.
That said, given your example, you would need test doubles for client and api. It's not clear where client is coming from, but assuming that's established as a double somehow, you'd have at a minimum:
api = double('api')
client.should_receive(:discovered_api).and_return(api)
api.stub_chain(:calendar_list, :list)
client.should_receive(:execute!).and_return(... whatever result you want ...)
If in addition you want to confirm that your code is passing the right parameters to the Google API, then you'd need to augment the above with message expectations and, in the case of the api stub_chain, a return value which would then have to feed into the message expectations for the execute! call.
I'm still not sure that answers your question, but if not, I'll look forward to reading any additional comments.
I have an object that I've faked with NSubstitute that has a method on it that gets called twice. I'd like to verify that the method has actually been called twice (and only twice). I've poked around the docs and Google with no luck. Any help would be appreciated. Thanks.
This currently isn't supported in NSubstitute 1.2.1 (the feature is implemented in a branch, and will make it to next release).
An alternative for now is to use substitute.ReceivedCalls() which will return an enumerable you can query. Another option is to use When..Do to increment a counter whenever the method is called, and assert that the counter ends up at 2.
Update 2011-11-19: This is supported in NSubstitute 1.3.0, using Received(int). It is documented on the Checking received calls page.