dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [dubbo] AlbumenJ commented on a change in pull request #8175: Transfer qos interface to BaseCommand
Date Mon, 12 Jul 2021 02:03:56 GMT

AlbumenJ commented on a change in pull request #8175:
URL: https://github.com/apache/dubbo/pull/8175#discussion_r667579116



##########
File path: dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/CountTelnetTest.java
##########
@@ -13,17 +13,19 @@
  * 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.dubbo.qos.legacy;
+ */package org.apache.dubbo.qos.command.impl;

Review comment:
       please recover for code style

##########
File path: dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java
##########
@@ -233,7 +233,8 @@ public void testOverrideConfigBySystemProps() {
             Assertions.assertEquals(1, registries.size());
             RegistryConfig registryConfig = registries.iterator().next();
             Assertions.assertEquals("zookeeper://localhost:2188", registryConfig.getAddress());
-        } finally {
+        } catch(Exception e){
+            e.printStackTrace();

Review comment:
       exceptions should not be ignored in unit test cases

##########
File path: dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/InvokeTelnetTest.java
##########
@@ -0,0 +1,256 @@
+/*
+ * 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.dubbo.qos.command.impl;
+
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
+import org.apache.dubbo.qos.command.BaseCommand;
+import org.apache.dubbo.qos.command.CommandContext;
+import org.apache.dubbo.qos.legacy.ProtocolUtils;
+import org.apache.dubbo.qos.legacy.service.DemoService;
+import org.apache.dubbo.qos.legacy.service.DemoServiceImpl;
+import org.apache.dubbo.remoting.RemotingException;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+import org.apache.dubbo.rpc.model.ServiceDescriptor;
+import org.apache.dubbo.rpc.model.ServiceRepository;
+
+import io.netty.channel.Channel;
+import io.netty.util.DefaultAttributeMap;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+
+public class InvokeTelnetTest {
+
+    private static final BaseCommand invoke = new InvokeTelnet();
+    private static final BaseCommand select = new SelectTelnet();
+    private Channel mockChannel;
+    private CommandContext mockCommandContext;
+    private final DefaultAttributeMap defaultAttributeMap = new DefaultAttributeMap();
+    private final ServiceRepository repository = ApplicationModel.getServiceRepository();
+
+    @BeforeEach
+    public void setup() {
+        DubboBootstrap.reset();
+        mockChannel = mock(Channel.class);
+        mockCommandContext = mock(CommandContext.class);
+        given(mockCommandContext.getRemote()).willReturn(mockChannel);
+    }
+
+    @AfterEach
+    public void after() {
+        ProtocolUtils.closeAll();

Review comment:
       reset DubboBootstrap after each test case




-- 
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: notifications-unsubscribe@dubbo.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Mime
View raw message