[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [lyo-dev] Challenge Adding Affected By Links to Requirements
|
Daniel,
The code looks right to me. I'd suggest setting a breakpoint in the debugger to make sure the requirement URI and eTag are what you expect. You can also print the response body from the server, which might give more information. They're examples of how to do that in RQMFormSample and RTCFormSample.
--
Samuel Padgett | IBM Rational | spadgett@xxxxxxxxxx
Eclipse Lyo: Enabling tool integration with OSLC
Daniel Chirillo---01/22/2014 07:21:06 PM---I'm trying to create Affected By (change request) links on RRC requirements. Server is responding
![]()
| ![]()
Daniel Chirillo/New York/IBM@IBMUS |
![]()
| ![]()
"Lyo project developer discussions" <lyo-dev@xxxxxxxxxxx> |
![]()
| ![]()
01/22/2014 07:21 PM |
![]()
| ![]()
[lyo-dev] Challenge Adding Affected By Links to Requirements |
![]()
| ![]()
lyo-dev-bounces@xxxxxxxxxxx |
I'm trying to create Affected By (change request) links on RRC requirements. Server is responding with a 412 (Pre-condition failed). I think the 2 key details to share are:
1. I am authenticating at /jts first
2. I'm getting the requirement by first getting an org.eclipse.lyo.oslc4j.core.model.Link to the requirement from its related test case and then passing the URI of that Link to getResource().getEntity():
public HashMap<String, Object> getRequirement(Link requirement) {
HashMap<String, Object> theRequirementAndEtag = new HashMap<String, Object>();
ClientResponse response = rrcClient.getResource(requirement.getValue().toString(), OslcMediaType.APPLICATION_RDF_XML);
Requirement theRequirement = response.getEntity(Requirement.class);
String eTag = response.getHeaders().getFirst(OSLCConstants.ETAG);
theRequirementAndEtag.put("requirement", theRequirement);
theRequirementAndEtag.put("etag", eTag);
response.consumeContent();
return theRequirementAndEtag;
}
3. I am including the eTag in the update request:
HashMap<String, Object> requirementAndEtag = myRrcUtil.getRequirement(requirements[i]);
Requirement requirement = (Requirement) requirementAndEtag.get("requirement");
String eTag = (String) requirementAndEtag.get("etag");
requirement.addAffectedBy(defectLink);
ClientResponse rrcResponse = rrcClient.updateResource(requirement.getAbout().toString(),
OslcMediaType.APPLICATION_RDF_XML,
OslcMediaType.APPLICATION_RDF_XML, eTag);
Regards,
Daniel Chirillo
IBM Software Services for Rational
1-720-395-0914 (voice & fax)
chirillo@xxxxxxxxxx_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/lyo-dev

