mirror of
https://github.com/apache/rocketmq-dashboard.git
synced 2026-02-20 03:55:42 +08:00
Co-authored-by: zhangjidi2016 <zhangjidi@cmss.chinamobile.com>
This commit is contained in:
@@ -63,7 +63,7 @@ public abstract class BaseControllerTest extends BaseTest {
|
||||
when(configure.getAccessKey()).thenReturn("12345678");
|
||||
when(configure.getSecretKey()).thenReturn("rocketmq");
|
||||
when(configure.getNamesrvAddr()).thenReturn("127.0.0.1:9876");
|
||||
when(configure.getNamesrvAddrs()).thenReturn(Lists.asList("127.0.0.1:9876", new String[] {"127.0.0.2:9876"}));
|
||||
when(configure.getNamesrvAddrs()).thenReturn(Lists.newArrayList("127.0.0.1:9876", "127.0.0.2:9876"));
|
||||
when(configure.isACLEnabled()).thenReturn(true);
|
||||
when(configure.isUseTLS()).thenReturn(false);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
@@ -83,6 +84,20 @@ public class OpsControllerTest extends BaseControllerTest {
|
||||
Assert.assertEquals(configure.getNamesrvAddr(), "127.0.0.1:9876");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddNameSvrAddr() throws Exception {
|
||||
final String url = "/ops/addNameSvrAddr.do";
|
||||
{
|
||||
doNothing().when(configure).setNamesrvAddrs(any());
|
||||
}
|
||||
requestBuilder = MockMvcRequestBuilders.post(url);
|
||||
requestBuilder.param("newNamesrvAddr", "127.0.0.3:9876");
|
||||
perform = mockMvc.perform(requestBuilder);
|
||||
perform.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.data").value(true));
|
||||
Assert.assertEquals(configure.getNamesrvAddrs().size(), 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateIsVIPChannel() throws Exception {
|
||||
final String url = "/ops/updateIsVIPChannel.do";
|
||||
|
||||
Reference in New Issue
Block a user