test_class.declarator: webApplicationContext
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private WebApplicationContext webApplicationContext;
test_class.type: WebApplicationContext
test_class.var_name: webApplicationContext
test_class.file: g11n-ws/vip-manager-l10n/src/test/java/com/vmware/l10n/translation/controller/TranslationSyncServerControllerTest.java
test_class.identifier: TranslationSyncServerControllerTest
test_case.body: @Test
  	public void testUpdateTranslation() throws Exception {
  		String API = L10NAPIV1.UPDATE_TRANSLATION_L10N.replace("{"+ APIParamName.PRODUCT_NAME + "}", "vCG").replace("{"+APIParamName.VERSION2+"}", "1.0.0");
  		 MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
  	        mockMvc.perform(MockMvcRequestBuilders.post(API)
  	                        .content(Constants.UPDATETRANSLATIONAPIREQUESTBODY)
  	                        .contentType(MediaType.APPLICATION_JSON)
  	                        .accept(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isOk())
  	                .andExpect(MockMvcResultMatchers.content().string(Constants.UPDATETRANSLATIONEXPECTRESULT));
  	}
test_case.class_method_signature: TranslationSyncServerControllerTest.testUpdateTranslation()
test_case.full_signature: @Test public void testUpdateTranslation()
test_case.identifier: testUpdateTranslation
test_case.invocations: replace replace build webAppContextSetup andExpect andExpect perform accept contentType content post isOk status string content
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUpdateTranslation()
focal_class.declarator: LOGGER = LoggerFactory
              .getLogger(TranslationSyncServerController.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger LOGGER = LoggerFactory
              .getLogger(TranslationSyncServerController.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: translationSyncServerService
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      TranslationSyncServerService translationSyncServerService;
focal_class.type: TranslationSyncServerService
focal_class.var_name: translationSyncServerService
focal_class.declarator: basePath
focal_class.modifier: @Value("${translation.bundle.file.basepath}")
      private
focal_class.original_string: @Value("${translation.bundle.file.basepath}")
      private String basePath;
focal_class.type: String
focal_class.var_name: basePath
focal_class.file: g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/controller/TranslationSyncServerController.java
focal_class.identifier: TranslationSyncServerController
focal_class.class_method_signature: TranslationSyncServerController.processMethod(Exception e, HttpServletRequest request,
              HttpServletResponse response)
focal_class.full_signature: @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.OK) public void processMethod(Exception e, HttpServletRequest request,
              HttpServletResponse response)
focal_class.identifier: processMethod
focal_class.modifiers: @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.OK) public
focal_class.parameters: (Exception e, HttpServletRequest request,
              HttpServletResponse response)
focal_class.return: void
focal_class.signature: void processMethod(Exception e, HttpServletRequest request,
              HttpServletResponse response)
focal_class.class_method_signature: TranslationSyncServerController.saveCreationInfo(UpdateTranslationDTO updateTranslationDTO)
focal_class.full_signature: private void saveCreationInfo(UpdateTranslationDTO updateTranslationDTO)
focal_class.identifier: saveCreationInfo
focal_class.modifiers: private
focal_class.parameters: (UpdateTranslationDTO updateTranslationDTO)
focal_class.return: void
focal_class.signature: void saveCreationInfo(UpdateTranslationDTO updateTranslationDTO)
focal_class.class_method_signature: TranslationSyncServerController.updateTranslation(
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)
focal_class.full_signature: @CrossOrigin @RequestMapping(value = L10NAPIV1.UPDATE_TRANSLATION_L10N, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO updateTranslation(
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)
focal_class.identifier: updateTranslation
focal_class.modifiers: @CrossOrigin @RequestMapping(value = L10NAPIV1.UPDATE_TRANSLATION_L10N, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public
focal_class.parameters: (
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)
focal_class.return: APIResponseDTO
focal_class.signature: APIResponseDTO updateTranslation(
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)
focal_method.body: @CrossOrigin
      @RequestMapping(value = L10NAPIV1.UPDATE_TRANSLATION_L10N, method = RequestMethod.POST, produces = { API.API_CHARSET })
      @ResponseStatus(HttpStatus.OK)
      public APIResponseDTO updateTranslation(
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request) {
          LOGGER.info("The request url is "
                  + request.getRequestURL()
                  + (request.getQueryString() == null ? "" : "?"
                          + request.getQueryString()));
      
          ObjectMapper mapper = new ObjectMapper();
          String requestJson = "";
          try {
              requestJson = mapper.writeValueAsString(updateTranslationDTO);
          } catch (JsonProcessingException e) {
          	LOGGER.error(e.getMessage(), e);
            
          }
          LOGGER.info("The request content is {}", requestJson);
          APIResponseDTO response = new APIResponseDTO();
          if (StringUtils.isEmpty(updateTranslationDTO)
                  || StringUtils.isEmpty(updateTranslationDTO.getData())
                  || StringUtils.isEmpty(updateTranslationDTO.getData()
                          .getTranslation())) {
              response.setResponse(APIResponseStatus.BAD_REQUEST);
              return response;
          }
          UpdateTranslationDataDTO updateTranslationDataDTO = updateTranslationDTO
                  .getData();
          List<TranslationDTO> translationList = updateTranslationDataDTO
                  .getTranslation();
          if (StringUtils.isEmpty(updateTranslationDataDTO.getProductName())
                  || !updateTranslationDataDTO.getProductName().equals(
                          productName)) {
              response.setResponse(APIResponseStatus.BAD_REQUEST);
              return response;
          }
          if (StringUtils.isEmpty(updateTranslationDataDTO.getVersion())
                  || !updateTranslationDataDTO.getVersion().equals(version)) {
              response.setResponse(APIResponseStatus.BAD_REQUEST);
              return response;
          }
          List<ComponentMessagesDTO> componentMessagesDTOList = new ArrayList<ComponentMessagesDTO>();
          for (TranslationDTO translationDTO : translationList) {
              if (StringUtils.isEmpty(translationDTO)) {
                  response.setResponse(APIResponseStatus.BAD_REQUEST);
                  return response;
              }
              ComponentMessagesDTO componentMessagesDTO = new ComponentMessagesDTO();
              componentMessagesDTO.setProductName(updateTranslationDataDTO
                      .getProductName());
              componentMessagesDTO.setVersion(updateTranslationDataDTO
                      .getVersion());
              componentMessagesDTO.setComponent(translationDTO.getComponent());
              componentMessagesDTO.setLocale(translationDTO.getLocale());
              componentMessagesDTO.setMessages(translationDTO.getMessages());
              componentMessagesDTO.setId(System.currentTimeMillis());
              componentMessagesDTOList.add(componentMessagesDTO);
          }
          List<TranslationDTO> translationDTOList = null;
          try {
              translationDTOList = translationSyncServerService
                      .updateBatchTranslation(componentMessagesDTOList);
          } catch (L10nAPIException e) {
              response.setResponse(APIResponseStatus.INTERNAL_SERVER_ERROR);
              LOGGER.error(e.getMessage(), e);
           
          }
          if (translationDTOList != null && translationDTOList.size() > 0) {
              response.setData(translationDTOList);
              response.setResponse(APIResponseStatus.OK);
          }
          saveCreationInfo(updateTranslationDTO);
          return response;
      }
focal_method.class_method_signature: TranslationSyncServerController.updateTranslation(
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)
focal_method.full_signature: @CrossOrigin @RequestMapping(value = L10NAPIV1.UPDATE_TRANSLATION_L10N, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO updateTranslation(
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)
focal_method.identifier: updateTranslation
focal_method.invocations: info getRequestURL getQueryString getQueryString writeValueAsString error getMessage info isEmpty isEmpty getData isEmpty getTranslation getData setResponse getData getTranslation isEmpty getProductName equals getProductName setResponse isEmpty getVersion equals getVersion setResponse isEmpty setResponse setProductName getProductName setVersion getVersion setComponent getComponent setLocale getLocale setMessages getMessages setId currentTimeMillis add updateBatchTranslation setResponse error getMessage size setData setResponse saveCreationInfo
focal_method.modifiers: @CrossOrigin @RequestMapping(value = L10NAPIV1.UPDATE_TRANSLATION_L10N, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public
focal_method.parameters: (
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)
focal_method.return: APIResponseDTO
focal_method.signature: APIResponseDTO updateTranslation(
              @RequestBody UpdateTranslationDTO updateTranslationDTO,
              @PathVariable(APIParamName.PRODUCT_NAME) String productName,
              @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request)