diff --git a/filter/impl/rejected_execution_handler_only_log_impl.go b/filter/impl/rejected_execution_handler_only_log_impl.go index 1ea44efb4cc129be35b84c57f3b7b87ac91f1a7b..bc67fa4ec450bcd5651fc0714a8ab7f75cfbe19f 100644 --- a/filter/impl/rejected_execution_handler_only_log_impl.go +++ b/filter/impl/rejected_execution_handler_only_log_impl.go @@ -36,8 +36,8 @@ import ( const HandlerName = "log" func init() { - extension.SetTpsRejectedExecutionHandler(HandlerName, GetOnlyRejectedExecutionHandler) - extension.SetTpsRejectedExecutionHandler(constant.DEFAULT_KEY, GetOnlyRejectedExecutionHandler) + extension.SetTpsRejectedExecutionHandler(HandlerName, GetOnlyLogRejectedExecutionHandler) + extension.SetTpsRejectedExecutionHandler(constant.DEFAULT_KEY, GetOnlyLogRejectedExecutionHandler) } var onlyLogHandlerInstance *OnlyLogRejectedExecutionHandler @@ -55,7 +55,7 @@ func (handler *OnlyLogRejectedExecutionHandler) RejectedExecution(url common.URL return &protocol.RPCResult{} } -func GetOnlyRejectedExecutionHandler() filter.RejectedExecutionHandler { +func GetOnlyLogRejectedExecutionHandler() filter.RejectedExecutionHandler { onlyLogHandlerOnce.Do(func() { onlyLogHandlerInstance = &OnlyLogRejectedExecutionHandler{} }) diff --git a/filter/impl/rejected_execution_handler_only_log_impl_test.go b/filter/impl/rejected_execution_handler_only_log_impl_test.go new file mode 100644 index 0000000000000000000000000000000000000000..da54d8a106338dd4f21f9b01e66b031e3c311e01 --- /dev/null +++ b/filter/impl/rejected_execution_handler_only_log_impl_test.go @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package impl + +import ( + "net/url" + "testing" +) +import ( + "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/constant" +) + +func TestOnlyLogRejectedExecutionHandler_RejectedExecution(t *testing.T) { + handler := GetOnlyLogRejectedExecutionHandler() + invokeUrl := common.NewURLWithOptions( + common.WithParams(url.Values{}), + common.WithParamsValue(constant.INTERFACE_KEY, "methodName")) + handler.RejectedExecution(*invokeUrl, nil) +}