AWS DeviceFarm: How to access test.parameters passed to "ScheduleRun" API - aws-api-gateway

Does anyone know how to access the test.parameters key-value pairs passed as input to the ScheduleRun API?
This is what I am doing:
Passing the input for the test to be run under test.filter.
Passing the parameters I need for my test under test.parameters. I have ensured it is a valid JSON object.
I am not passing any yaml file, so a "standard" test run gets triggered on DeviceFarm.
Here is my code that I use to retrieve the data:
final Bundle bundle = InstrumentationRegistry.getArguments();
for (final String key : bundle.keySet())
{
final Object obj = bundle.get(key);
Log.i(TAG, "Key - '" + key + "' ; Value - '" + obj.toString() + "'");
}
I know the test.filter part works because the InstrumentationRegistry.getArguments() bundle is able to retrieve the class value which is the test that needs to be run. Unfortunately, the test.parameters values are not present in the bundle.
Is there anything that I am missing or should I use some other mechanism to retrieve the test.parameters ?

Got confirmation from the AWS team that, at this point, they don't support this feature for Custom environments.

Related

Is it possible to access the VSTS data storage from outside of VSTS?

I use the code below to access the data storage in my VSTS extension.
// Get data service
VSS.getService(VSS.ServiceIds.ExtensionData).then(function(dataService) {
// Get all document under the collection
dataService.getDocuments("MyCollection").then(function(docs) {
console.log("There are " + docs.length + " in the collection.");
});
});
Is it possible to use this in a general web app that does not use VSTS?
I just want to access the data stored in a different web app.
Make a call to this URL should work:
https://{yourvstsaccount}.extmgmt.visualstudio.com/_apis/ExtensionManagement/InstalledExtensions/{extensionpublisherName}/{extensionname}/Data/Scopes/{scope}/Collections/{collectionName}/Documents/{documentName}
For exmaple:

Not able to access parameter passed in RESTful web service

I have created a RESTful web service. It is working fine when I run it. But whenever I pass any parameter to that web service through the URL created, I am not able to access that parameter.
The URL of web service is:
http://localhost:8080/Web_service/path/simple/sam
where sam is the parameter passed by me and path is used for accessing the class.
In my web service, I am trying to access the passed parameter as shown in the screenshot below:
This is my code's screenshot
I do not get back the parameter concatenated with "Hello " as I desire, but I only get "Hello " returned.
Please help !
#Get
#Produces(MediaType.TEXT_PLAIN)
#Path("/simple/{tem}")
public String test(#PathVariable("tem") String tem) {
String t = "Hello " + tem;
return t;
}

Starring a repository with the github API

I'm trying to star a repository using the GithubAPI. This is done via a PUT request to /user/starred/:owner/:repo. I attempted to implement this feature in python using the requests library, but it isn't working. Here is a minimum working example:
The constant are defined as GITHUB_API = api.github.com, GITHUB_USER = the username of the owner of the repo to be starred, and GITHUB_REPO = the name of the repo to be starred
url = urljoin(GITHUB_API, (user + '/starred/' + GITHUB_USER + '/' + GITHUB_REPO))
r = requests.put(url,auth=(user,password))
print r.text
This code results in an error that reads:
{"message":"Not Found","documentation_url":"https://developer.github.com/v3"}
I think that I'm missing something fundamental about the process of issuing a PUT request.
The problem here is the parameters you pass to urljoin(). The first parameter is supposed to be an absolute URL, while the second parameter is a relative URL. urljoin() then creates an absolute URL from that.
Also, "user" in this case is supposed to be a literal part of the URL, and not the username.
In this case, I would forgo the urljoin()-function completely, and instead use simple string substitution:
url = 'https://api.github.com/user/starred/{owner}/{repo}'.format(
owner=GITHUB_USER,
repo=GITHUB_REPO
)

API Blueprint schema usage

We want to use API blueprint together with a schema. Let's say, we want to specify that PUT to a resource accepts an Account in the payload and GET on the same resource returns an Account payload. So I need to specify that Account is used in GET and PUT and I need to specify the Account itself. I do not know where to specify it, what's the canonical way? Unfortunately I was not able to find it in the examples.
Reusing one message payload in multiple action is where can utilize the concept of a resource model.
Simply define a account model and then reuse it later like so:
# Account [/account]
+ Model (application/json)
+ Body
{ ... }
+ Schema
{ ... }
## Retrieve an Account [GET]
+ Response 200
[Account][]
## Update an Account [PUT]
+ Request
[Account][]
+ Response 204

Sales Force Exposing Custom Objects via REST API

I am new to sales force and I have a problem. I would like to manipulate (created,update,delete and select) data from my custom objects using the REST API.
I have managed to get the sample working and it is sending me the data for accounts. Details
Now I would like to do the same for the Custom Object I have created.
I have tried this code but it is not working.
HttpClient httpclient = new HttpClient();
GetMethod get = new GetMethod(instanceUrl + "/services/data/v22.0/sobjects/Employee__c/EC-1000");
get.setRequestHeader("Authorization", "OAuth " + accessToken);
httpclient.executeMethod(get);
System.out.println("Status:" + get.getStatusCode());
System.out.println("Status Text:" + get.getStatusText());
Output is:
Status:404
Status Text:Not Found
I created an object with name employee and ID EC-1000.
The above works for the default objects that is Account.
It works exactly the same way, except you use your custom object's API name instead of the standard object name, e.g. If you have a custom object called Handsets, its api name will be Handsets__c, and you can do a POST to /services/data/v22.0/sobjects/Handsets__c to create a new one.
To access a particular record you need the 18 character record Id, just like for the account (or you need an externalId field setup).