You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/09 14:02:24 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #14616: [Feature] intercept ACK command by BrokerInterceptor.

codelipenghui commented on a change in pull request #14616:
URL: https://github.com/apache/pulsar/pull/14616#discussion_r822678852



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerInterceptorTest.java
##########
@@ -0,0 +1,80 @@
+/**
+ * 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 org.apache.pulsar.broker.service;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import org.apache.pulsar.broker.intercept.BrokerInterceptor;
+import org.apache.pulsar.common.api.proto.BaseCommand;
+import org.apache.pulsar.common.api.proto.CommandAck;
+import org.apache.pulsar.common.api.proto.MessageIdData;
+import org.apache.pulsar.common.protocol.Commands;
+import org.mockito.Mockito;
+import org.powermock.reflect.Whitebox;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.CALLS_REAL_METHODS;
+
+public class BrokerInterceptorTest {

Review comment:
       @tjiuming If not able to use the existing `BrokerInterceptorTest`, could you please move the new test class under the `org.apache.pulsar.broker.intercept` package and use a different class name? Otherwise, the new test class most likely not be used in the future.
   
   And the new test class should under the "broker" test group.
   
   BTW, looks like it's easy to improve the existing test `testBeforeSendMessage` to cover the new change, send some messages, consume and ack them later, then check the interceptor works well. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org