You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tubemq.apache.org by GitBox <gi...@apache.org> on 2020/12/01 11:48:44 UTC

[GitHub] [incubator-tubemq] EMsnap opened a new pull request #334: [TUBEMQ-439] Add cluster info query

EMsnap opened a new pull request #334:
URL: https://github.com/apache/incubator-tubemq/pull/334


   [TUBEMQ-439] Add cluster info query


----------------------------------------------------------------
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.

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



[GitHub] [incubator-tubemq] gosonzhang merged pull request #334: [TUBEMQ-439] Add cluster info query

Posted by GitBox <gi...@apache.org>.
gosonzhang merged pull request #334:
URL: https://github.com/apache/incubator-tubemq/pull/334


   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-tubemq] yuanboliu commented on a change in pull request #334: [TUBEMQ-439] Add cluster info query

Posted by GitBox <gi...@apache.org>.
yuanboliu commented on a change in pull request #334:
URL: https://github.com/apache/incubator-tubemq/pull/334#discussion_r533371143



##########
File path: tubemq-manager/src/test/java/org/apache/tubemq/manager/controller/TestNodeController.java
##########
@@ -0,0 +1,77 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.tubemq.manager.controller;
+
+import com.google.gson.Gson;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.tubemq.manager.controller.cluster.ClusterController;
+import org.apache.tubemq.manager.entry.NodeEntry;
+import org.apache.tubemq.manager.repository.NodeRepository;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.http.MediaType;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.RequestBuilder;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@AutoConfigureMockMvc
+public class TestNodeController {
+
+    private final Gson gson = new Gson();
+
+    @MockBean
+    private NodeRepository nodeRepository;
+
+    @Autowired
+    private MockMvc mockMvc;
+
+    private NodeEntry getNodeEntry() {
+        NodeEntry nodeEntry = new NodeEntry();
+        nodeEntry.setMaster(true);
+        nodeEntry.setIp("127.0.0.1");
+        nodeEntry.setWebPort(8014);
+        return nodeEntry;
+    }
+
+    @Test
+    public void testClusterInfo() throws Exception {
+        RequestBuilder request = get("/v1/node/query?method=admin_query_cluster_info&" +
+                "type=op_query&clusterId=1");
+        MvcResult result = mockMvc.perform(request).andReturn();
+        String resultStr = result.getResponse().getContentAsString();
+        log.info("result json string is {}, response type is {}", resultStr,

Review comment:
       please use Assert.equals to make sure the result value is correct.




----------------------------------------------------------------
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.

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



[GitHub] [incubator-tubemq] yuanboliu commented on pull request #334: [TUBEMQ-439] Add cluster info query

Posted by GitBox <gi...@apache.org>.
yuanboliu commented on pull request #334:
URL: https://github.com/apache/incubator-tubemq/pull/334#issuecomment-737023516


   +1 pending on travis result


----------------------------------------------------------------
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.

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