test_class.declarator: mockMvc
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private MockMvc mockMvc;
test_class.type: MockMvc
test_class.var_name: mockMvc
test_class.declarator: subscriptionService
test_class.modifier: @MockBean
  	private
test_class.original_string: @MockBean
  	private SubscriptionService subscriptionService;
test_class.type: SubscriptionService
test_class.var_name: subscriptionService
test_class.declarator: subscriptionController
test_class.modifier: @InjectMocks
  	private
test_class.original_string: @InjectMocks
  	private SubscriptionController subscriptionController;
test_class.type: SubscriptionController
test_class.var_name: subscriptionController
test_class.declarator: contextResolver
test_class.modifier: @Autowired
test_class.original_string: @Autowired
  	ContextResolverBasic contextResolver;
test_class.type: ContextResolverBasic
test_class.var_name: contextResolver
test_class.declarator: paramsResolver
test_class.modifier: @Autowired
test_class.original_string: @Autowired
  	ParamsResolver paramsResolver;
test_class.type: ParamsResolver
test_class.var_name: paramsResolver
test_class.declarator: subscriptionEntityPayload
test_class.modifier: private
test_class.original_string: private String subscriptionEntityPayload;
test_class.type: String
test_class.var_name: subscriptionEntityPayload
test_class.file: Core/SubscriptionManager/src/test/java/eu/neclab/ngsildbroker/subscriptionmanager/controller/SubscriptionControllerTest.java
test_class.identifier: SubscriptionControllerTest
test_case.body: @Test
  	public void updateSubscriptionNotFoundTest() {
  		try {
  			when(subscriptionService.updateSubscription(any())).
  			thenThrow(new ResponseException(ErrorType.NotFound));
  			mockMvc.perform(patch("/ngsi-ld/v1/subscriptions/urn:ngsi-ld:Subscription:211/")
  							.contentType(AppConstants.NGB_APPLICATION_JSON).accept(AppConstants.NGB_APPLICATION_JSONLD)
  							.content(subscriptionEntityPayload))
  					.andExpect(status().isNotFound());
  		} catch (Exception e) {
  			Assert.fail();
  			e.printStackTrace();
  		}
  		
  	}
test_case.class_method_signature: SubscriptionControllerTest.updateSubscriptionNotFoundTest()
test_case.full_signature: @Test public void updateSubscriptionNotFoundTest()
test_case.identifier: updateSubscriptionNotFoundTest
test_case.invocations: thenThrow when updateSubscription any andExpect perform content accept contentType patch isNotFound status fail printStackTrace
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void updateSubscriptionNotFoundTest()
focal_class.declarator: logger = LogManager.getLogger(SubscriptionController.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Logger logger = LogManager.getLogger(SubscriptionController.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: manager
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
  	SubscriptionManager manager;
focal_class.type: SubscriptionManager
focal_class.var_name: manager
focal_class.declarator: contextResolver
focal_class.modifier: @Autowired
  	@Qualifier("smconRes")
focal_class.original_string: @Autowired
  	@Qualifier("smconRes")
  	ContextResolverBasic contextResolver;
focal_class.type: ContextResolverBasic
focal_class.var_name: contextResolver
focal_class.declarator: kafkaOps
focal_class.modifier: @Autowired
  	@Qualifier("smops")
focal_class.original_string: @Autowired
  	@Qualifier("smops")
  	KafkaOps kafkaOps;
focal_class.type: KafkaOps
focal_class.var_name: kafkaOps
focal_class.declarator: eurekaClient
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
  	EurekaClient eurekaClient;
focal_class.type: EurekaClient
focal_class.var_name: eurekaClient
focal_class.declarator: atContextServerUrl
focal_class.modifier: @Value("${atcontext.url}")
focal_class.original_string: @Value("${atcontext.url}")
  	String atContextServerUrl;
focal_class.type: String
focal_class.var_name: atContextServerUrl
focal_class.declarator: queryParser
focal_class.modifier: @Autowired
  	@Qualifier("smqueryParser")
focal_class.original_string: @Autowired
  	@Qualifier("smqueryParser")
  	QueryParser queryParser;
focal_class.type: QueryParser
focal_class.var_name: queryParser
focal_class.declarator: ldTools
focal_class.modifier: @Autowired
  	@Qualifier("smparamsResolver")
focal_class.original_string: @Autowired
  	@Qualifier("smparamsResolver")
  	ParamsResolver ldTools;
focal_class.type: ParamsResolver
focal_class.var_name: ldTools
focal_class.declarator: badRequest = new ResponseException(ErrorType.BadRequestData)
focal_class.original_string: ResponseException badRequest = new ResponseException(ErrorType.BadRequestData);
focal_class.type: ResponseException
focal_class.var_name: badRequest
focal_class.declarator: badRequestResponse = ResponseEntity.status(badRequest.getHttpStatus())
  			.body(new RestResponse(badRequest).toJsonBytes())
focal_class.original_string: ResponseEntity<byte[]> badRequestResponse = ResponseEntity.status(badRequest.getHttpStatus())
  			.body(new RestResponse(badRequest).toJsonBytes());
focal_class.type: ResponseEntity<byte[]>
focal_class.var_name: badRequestResponse
focal_class.declarator: httpUtils
focal_class.modifier: private
focal_class.original_string: private HttpUtils httpUtils;
focal_class.type: HttpUtils
focal_class.var_name: httpUtils
focal_class.file: Core/SubscriptionManager/src/main/java/eu/neclab/ngsildbroker/subscriptionmanager/controller/SubscriptionController.java
focal_class.identifier: SubscriptionController
focal_class.class_method_signature: SubscriptionController.setup()
focal_class.full_signature: @PostConstruct private void setup()
focal_class.identifier: setup
focal_class.modifiers: @PostConstruct private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setup()
focal_class.class_method_signature: SubscriptionController.subscribeRest(HttpServletRequest request, @RequestBody String payload)
focal_class.full_signature: @RequestMapping(method = RequestMethod.POST) @ResponseBody public ResponseEntity<byte[]> subscribeRest(HttpServletRequest request, @RequestBody String payload)
focal_class.identifier: subscribeRest
focal_class.modifiers: @RequestMapping(method = RequestMethod.POST) @ResponseBody public
focal_class.parameters: (HttpServletRequest request, @RequestBody String payload)
focal_class.return: ResponseEntity<byte[]>
focal_class.signature: ResponseEntity<byte[]> subscribeRest(HttpServletRequest request, @RequestBody String payload)
focal_class.class_method_signature: SubscriptionController.getAllSubscriptions(HttpServletRequest request,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.full_signature: @RequestMapping(method = RequestMethod.GET, value = "/") public ResponseEntity<byte[]> getAllSubscriptions(HttpServletRequest request,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.identifier: getAllSubscriptions
focal_class.modifiers: @RequestMapping(method = RequestMethod.GET, value = "/") public
focal_class.parameters: (HttpServletRequest request,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.return: ResponseEntity<byte[]>
focal_class.signature: ResponseEntity<byte[]> getAllSubscriptions(HttpServletRequest request,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.class_method_signature: SubscriptionController.getSubscriptions(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) String id,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.full_signature: @RequestMapping(method = RequestMethod.GET, value = "/{id}") public ResponseEntity<byte[]> getSubscriptions(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) String id,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.identifier: getSubscriptions
focal_class.modifiers: @RequestMapping(method = RequestMethod.GET, value = "/{id}") public
focal_class.parameters: (HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) String id,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.return: ResponseEntity<byte[]>
focal_class.signature: ResponseEntity<byte[]> getSubscriptions(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) String id,
  			@RequestParam(required = false, name = "limit", defaultValue = "0") int limit)
focal_class.class_method_signature: SubscriptionController.deleteSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id)
focal_class.full_signature: @RequestMapping(method = RequestMethod.DELETE, value = "/{id}") public ResponseEntity<byte[]> deleteSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id)
focal_class.identifier: deleteSubscription
focal_class.modifiers: @RequestMapping(method = RequestMethod.DELETE, value = "/{id}") public
focal_class.parameters: (HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id)
focal_class.return: ResponseEntity<byte[]>
focal_class.signature: ResponseEntity<byte[]> deleteSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id)
focal_class.class_method_signature: SubscriptionController.updateSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)
focal_class.full_signature: @RequestMapping(method = RequestMethod.PATCH, value = "/{" + NGSIConstants.QUERY_PARAMETER_ID + "}") public ResponseEntity<byte[]> updateSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)
focal_class.identifier: updateSubscription
focal_class.modifiers: @RequestMapping(method = RequestMethod.PATCH, value = "/{" + NGSIConstants.QUERY_PARAMETER_ID + "}") public
focal_class.parameters: (HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)
focal_class.return: ResponseEntity<byte[]>
focal_class.signature: ResponseEntity<byte[]> updateSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)
focal_method.body: @RequestMapping(method = RequestMethod.PATCH, value = "/{" + NGSIConstants.QUERY_PARAMETER_ID + "}")
  	public ResponseEntity<byte[]> updateSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload) {
  		logger.trace("call updateSubscription() ::");
  
  		try {
  			HttpUtils.doPreflightCheck(request, payload);
  			List<Object> context = HttpUtils.getAtContext(request);
  			String resolved = contextResolver.expand(payload, context, true, AppConstants.SUBSCRIPTIONS_URL_ID);
  			Subscription subscription = DataSerializer.getSubscription(resolved);
  			if (subscription.getId() == null) {
  				subscription.setId(id);
  			}
  			SubscriptionRequest subscriptionRequest = new SubscriptionRequest(subscription, context);
  
  			// expandSubscriptionAttributes(subscription, context);
  			if (resolved == null || subscription == null || !id.equals(subscription.getId())) {
  				return badRequestResponse;
  			}
  			manager.updateSubscription(subscriptionRequest);
  		} catch (ResponseException e) {
  			logger.error("Exception ::", e);
  			return ResponseEntity.status(e.getHttpStatus()).body(new RestResponse(e).toJsonBytes());
  		}
  		return ResponseEntity.noContent().build();
  	}
focal_method.class_method_signature: SubscriptionController.updateSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)
focal_method.full_signature: @RequestMapping(method = RequestMethod.PATCH, value = "/{" + NGSIConstants.QUERY_PARAMETER_ID + "}") public ResponseEntity<byte[]> updateSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)
focal_method.identifier: updateSubscription
focal_method.invocations: trace doPreflightCheck getAtContext expand getSubscription getId setId equals getId updateSubscription error body status getHttpStatus toJsonBytes build noContent
focal_method.modifiers: @RequestMapping(method = RequestMethod.PATCH, value = "/{" + NGSIConstants.QUERY_PARAMETER_ID + "}") public
focal_method.parameters: (HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)
focal_method.return: ResponseEntity<byte[]>
focal_method.signature: ResponseEntity<byte[]> updateSubscription(HttpServletRequest request,
  			@PathVariable(name = NGSIConstants.QUERY_PARAMETER_ID, required = true) URI id,
  			@RequestBody String payload)