@Override public ResponseEntity<Void> putConfigData(@Valid @RequestBody final DdiConfigData configData, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId) { controllerManagement.updateControllerAttributes(controllerId, configData.getData(), getUpdateMode(configData)); return ResponseEntity.ok().build(); }
@Override public ResponseEntity<Void> putConfigData(@Valid @RequestBody final DdiConfigData configData, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId) { controllerManagement.updateControllerAttributes(controllerId, configData.getData(), getUpdateMode(configData)); return ResponseEntity.ok().build(); }
private void updateAttributes(final Message message) { final DmfAttributeUpdate attributeUpdate = convertMessage(message, DmfAttributeUpdate.class); final String thingId = getStringHeaderKey(message, MessageHeaderKey.THING_ID, "ThingId is null"); controllerManagement.updateControllerAttributes(thingId, attributeUpdate.getAttributes(), getUpdateMode(attributeUpdate)); }
@Test @Description("Handles the GET request of retrieving the attributes of a specific target. Reponse is a key/value list. Required Permission: READ_TARGET.") public void getControllerAttributes() throws Exception { // create target with attributes final Map<String, String> knownControllerAttrs = new HashMap<>(); knownControllerAttrs.put("a", "1"); knownControllerAttrs.put("b", "2"); final Target target = testdataFactory.createTarget(targetId); controllerManagement.updateControllerAttributes(targetId, knownControllerAttrs, null); // test query target over rest resource mockMvc.perform(get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/attributes", target.getName())) .andDo(MockMvcResultPrinter.print()).andExpect(status().is2xxSuccessful()) .andExpect(jsonPath("$.a", equalTo("1"))).andExpect(jsonPath("$.b", equalTo("2"))) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)))); }