There is some mixup between Target and TargetState in there. The former is an entity representing an actual resource that can be created/updated. The latter is just a readonly valueobject of some server side state. The fact that on create/update the state is actually send to the server is just a result of the way it was implemented (see AMDATU-602 for seem earlier thought on that).

To resolve this issue I have change the TargetBuilder to set the attribute as Alexander suggested. Furthermore, I removed the setters/updates on TargetState and updated javadoc in an effort to avoid confusion. Finally, I also removed some redundant getter for state from the target.

Sample test code:

{code]
@Test
public void testSetAutoApproveOnTarget() throws Exception { AceClient c = new AceClient("http://localhost:8080/client/work"); AceClientWorkspace w = c.createNewWorkspace(); String targetId = "target-" + System.currentTimeMillis(); Target target = new TargetBuilder() .setId(targetId) .setAutoApprove(true) .build(); String resourceId = w.createResource(target); target = w.getResource(Target.class, resourceId); Assert.assertTrue(target.getState().isAutoApprove()); Assert.assertTrue(target.isAutoApprove()); target.setAutoApprove(false); Assert.assertTrue(target.getState().isAutoApprove()); Assert.assertFalse(target.isAutoApprove()); w.updateResource(target); target = w.getResource(Target.class, resourceId); Assert.assertFalse(target.getState().isAutoApprove()); Assert.assertFalse(target.isAutoApprove()); w.commit(); w.remove(); }


This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
Amdatu-developers mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-developers

Reply via email to