I tried the below code to create test cases under existing folder. I'm able to create the testcase but dont see it under the associated folder.
QueryRequest testFolderRequest = new QueryRequest("TestFolder");
testFolderRequest .setFetch(new Fetch("FormattedID", "Name"));
QueryResponse testFolderQueryResponse = restApi.query(testsetRequest);
// JsonObject testSetJsonObject =
// testSetQueryResponse.getResults().get(0).getAsJsonObject();
String testFolderReference = testFolderQueryResponse.getResults().get(0)
.getAsJsonObject().get("_ref").toString();
// System.out.println("TestFolder object: "+testSetRef);
JsonObject newTestCase = new JsonObject();
newTestCase.addProperty("Name", "Newly added testcase in a folder");
newTestCase.addProperty("Test Folder", testFolderReference);
CreateRequest createRequest = new CreateRequest("testcase", newTestCase);
CreateResponse response = restApi.create(createRequest);
System.out.println(response.toString());
JsonObject json = response.getObject();
System.out.println(json);
Attributes in webservices API shouldn't have spaces. So:
newTestCase.addProperty("TestFolder", testFolderReference);
Should work.
Related
I have created on test set and i want to add test case in existing test run . I used update request to add the test case, but its deleting existing test case in test run and adding it.
if(!testCaseList.isJsonNull()&&!update){
restApi.setApplicationName("PSN")
JsonObject newTS = new JsonObject()
newTS.addProperty("Name", TSName)
newTS.addProperty("PlanEstimate", points)
newTS.addProperty("Project", projectRef)
newTS.addProperty("Owner", userRef)
if (releaseRef!="") newTS.addProperty("Release", releaseRef)
if (iterationRef!="") newTS.addProperty("Iteration", iterationRef)
newTS.add("TestCases", testCaseList)
CreateRequest createRequest = new CreateRequest("testset",newTS)
CreateResponse createResponse = restApi.create(createRequest)
ref = createResponse.getObject().get("_ref").getAsString()
}
else if(!testCaseList.isJsonNull()&&update){
restApi.setApplicationName("PSN")
newTS.addProperty("Name", TSName)
newTS.addProperty("PlanEstimate", points)
newTS.addProperty("Project", projectRef)
newTS.addProperty("Owner", userRef)
if (releaseRef!="") newTS.addProperty("Release", releaseRef)
if (iterationRef!="") newTS.addProperty("Iteration", iterationRef)
newTS.add("TestCases", testCaseList)
UpdateRequest updateRequest = new UpdateRequest(ref,newTS)
UpdateResponse updateResponse = restApi.update(updateRequest)
ref = updateResponse.getObject().get("_ref").getAsString()
}
Rather than setting the TestCases collection directly you want to use the CollectionUpdateRequest and the updateCollection method.
https://github.com/RallyTools/RallyRestToolkitForJava/wiki/User-Guide#update-collection
CollectionUpdateRequest testsetTestCasesAddRequest = new CollectionUpdateRequest(ref + "/testcases", testCaseList, true);
CollectionUpdateResponse testsetTestCasesAddResponse = restApi.updateCollection(testsetTestCasesAddRequest);
I created a connection to rally using the ApiKey constructor.
Question is how do i find out the User "_ref" associated with this User ApiKey ?
rallyRestApi= new RallyRestApi(new URI(host), "myApiKey");
I tried following 2 test runs:
doing a blank query (i.e. without any setQueryFilter) on User object; it returns me all the users.
QueryRequest userRequest = new QueryRequest("User");
QueryResponse userQueryResponse = connection.query(userRequest);
JsonArray userQueryResults = userQueryResponse.getResults();
Getting owner from Workspace object >> This returns me the owner of the Workspace
You may get a current user:
GetRequest getRequest = new GetRequest("/user");
GetResponse getResponse = restApi.get(getRequest);
JsonObject currentUser = getResponse.getObject();
String currentUserName = currentUser.get("_refObjectName").getAsString();
String currentUserRef = currentUser.get("_ref").getAsString();
System.out.println("current user: " + currentUserName + currentUserRef);
I tested it with latest Rally API toolkit for Java.
I´d like to know why this code is not working. It runs without errors but rows are not inserted. I´m using C# client library.
Any ideas? Thanks!!
string SERVICE_ACCOUNT_EMAIL = "(myserviceaccountemail)";
string SERVICE_ACCOUNT_PKCS12_FILE_PATH = #"C:\(myprivatekeyfile)";
System.Security.Cryptography.X509Certificates.X509Certificate2 certificate =
new System.Security.Cryptography.X509Certificates.X509Certificate2(SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret",
System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(SERVICE_ACCOUNT_EMAIL)
{
Scopes = new[] { BigqueryService.Scope.BigqueryInsertdata, BigqueryService.Scope.Bigquery }
}.FromCertificate(certificate));
// Create the service.
var service = new BigqueryService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "test"
});
Google.Apis.Bigquery.v2.Data.TableDataInsertAllRequest tabreq = new Google.Apis.Bigquery.v2.Data.TableDataInsertAllRequest();
List<Google.Apis.Bigquery.v2.Data.TableDataInsertAllRequest.RowsData> tabrows = new List<Google.Apis.Bigquery.v2.Data.TableDataInsertAllRequest.RowsData>();
Google.Apis.Bigquery.v2.Data.TableDataInsertAllRequest.RowsData rd = new Google.Apis.Bigquery.v2.Data.TableDataInsertAllRequest.RowsData();
IDictionary<string,object> r = new Dictionary<string,object>();
r.Add("campo1", "test4");
r.Add("campo2", "test5");
rd.Json = r;
tabrows.Add(rd);
tabreq.Rows = tabrows;
service.Tabledata.InsertAll(tabreq, "(myprojectid)", "spots", "spots");
I think you should add the Kind field [1]. It should be something like this:
tabreq.Kind = "bigquery#tableDataInsertAllRequest";
Also remeber that every request of the API has a response [2] with additional info to help you find the issue's root cause.
var requestResponse = service.Tabledata.InsertAll(tabreq, "(myprojectid)", "spots", "spots");
[1] https://developers.google.com/resources/api-libraries/documentation/bigquery/v2/csharp/latest/classGoogle_1_1Apis_1_1Bigquery_1_1v2_1_1Data_1_1TableDataInsertAllRequest.html#aa2e9b0da5e15b158ae0d107378376b26
[2] https://cloud.google.com/bigquery/docs/reference/v2/tabledata/insertAll
I have used the following code to Add a new Test Case and associate to an existing UserStory in Rally. It creates the new test case but does not associate with the existing User Story US4.Am I missing any references.Any Help would be highly appreciated
String storyFormattedID = "US4";
QueryRequest storyRequest = new QueryRequest("HierarchicalRequirement");
storyRequest.setFetch(new Fetch("FormattedID", "Name", "Changesets"));
storyRequest.setQueryFilter(new QueryFilter("FormattedID", "=",
storyFormattedID));
QueryResponse storyQueryResponse = restApi.query(storyRequest);
JsonObject storyJsonObject = storyQueryResponse.getResults().get(0)
.getAsJsonObject();
String storyRef = storyJsonObject.get("_ref").toString();
JsonObject newTestCase = new JsonObject();
newTestCase.addProperty("Name", "Test Case");
newTestCase.addProperty("Requirement", storyRef);
newTestCase.addProperty("Name",
"Newly added testcase associated to a Story");
CreateRequest createRequest = new CreateRequest("testcase", newTestCase);
CreateResponse response = restApi.create(createRequest);
System.out.println(response.toString());
JsonObject json = response.getObject();
System.out.println(json);
The correct attribute to associate a TestCase to a HierarchicalRequirement is WorkProduct, since TestCases can associate either to HierarchicalRequirement or Defect. So:
newTestCase.addProperty("WorkProduct", storyRef);
Should do the trick for you.
I am working on Adobe Echo sign,I have downloaded the sample code from their website, I am using this sample code for sendingdocument, it has some code missing in sendDocument method so I have changed it. It's giving SoapHeader Exception,with nothing in InnerException,
{"apiActionId=XHZI4WF4BV693YS"}
below is my code of sending document
public static void sendDocument(string apiKey, string fileName, string recipient)
{
ES = new EchoSignDocumentService16();
FileStream file = File.OpenRead(fileName);
secure.echosign.com.FileInfo[] fileInfos = new secure.echosign.com.FileInfo[1];
fileInfos[0] = new secure.echosign.com.FileInfo(fileName, null, file);
SenderInfo senderInfo = null;
string[] recipients = new string[1];
recipients[0] = recipient;
DocumentCreationInfo documentInfo = new DocumentCreationInfo(
recipients,
"Test from SOAP: " + fileName,
"This is neat.",
fileInfos,
SignatureType.ESIGN,
SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
);
DocumentKey[] documentKeys;
senderInfo = new SenderInfo(recipient, "password", "APIKEY");
documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo);
Console.WriteLine("Document key is: " + documentKeys[0].documentKey);
}
its giving exception on this line
documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo);
Can anyone suggest some sample code of Adobe Echo Sign?
On the account page of your login there is an API log you can check. If you check the log entry for your request you may find more information there.
I can't see anything immediately wrong with your code however the EchoSign API guide says that the 'tos' field is deprecated and that the recipients field should be used instead. Helpfully this means you can't use the paramaterised constructor. Try creating your document creation info as such (this is C# but if you need Java it should be straightforward to figure out):
RecipientInfo[] recipientInfo = new RecipientInfo[1];
recipientInfo[0] = new RecipientInfo
{
email = "recipient",
role = RecipientRole.SIGNER,
roleSpecified = true
};
DocumentCreationInfo documentCreationInfo = new DocumentCreationInfo
{
recipients = recipientInfo,
name = "Test from SOAP: " + fileName,
message = "This is neat.",
fileInfos = fileInfos,
signatureType = SignatureType.ESIGN,
signatureFlow = SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
};
Note that when using the recipientInfo array it seems that the roleSpecified field must be set to true. This little field tripped me up for ages and I was receiving errors similar to yours.