@PutMapping
    @TpsControl(pointName = "NamingServiceUpdate", name = "HttpNamingServiceUpdate")
    @Secured(action = ActionTypes.WRITE)
    public String update(HttpServletRequest request) throws Exception {
        String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID);
        String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME);
        Map<String, String> metadata = UtilsAndCommons.parseMetadata(
                WebUtils.optional(request, "metadata", StringUtils.EMPTY));
        ServiceMetadata serviceMetadata = new ServiceMetadata();
        serviceMetadata.setProtectThreshold(NumberUtils.toFloat(WebUtils.required(request, "protectThreshold")));
        serviceMetadata.setExtendData(metadata);
        serviceMetadata.setSelector(parseSelector(WebUtils.optional(request, "selector", StringUtils.EMPTY)));
        com.alibaba.nacos.naming.core.v2.pojo.Service service = com.alibaba.nacos.naming.core.v2.pojo.Service.newService(
                namespaceId, NamingUtils.getGroupName(serviceName), NamingUtils.getServiceName(serviceName));
        getServiceOperator().update(service, serviceMetadata);
        NotifyCenter.publishEvent(new UpdateServiceTraceEvent(System.currentTimeMillis(), namespaceId,
                NamingUtils.getGroupName(serviceName), NamingUtils.getServiceName(serviceName), metadata));
        return "ok";
    }
@Test
    void testUpdate() throws Exception {
        MockHttpServletRequest servletRequest = new MockHttpServletRequest();
        servletRequest.addParameter(CommonParams.SERVICE_NAME, TEST_SERVICE_NAME);
        servletRequest.addParameter("protectThreshold", "0.01");
        try {
            String res = serviceController.update(servletRequest);
            assertEquals("ok", res);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
        TimeUnit.SECONDS.sleep(1);
        assertEquals(UpdateServiceTraceEvent.class, eventReceivedClass);
    }