其他分享
首页 > 其他分享> > 分布式-raft

分布式-raft

作者:互联网

mini-raft

git地址

raft implementation 8 java

参考raft-java

todo

依赖

测试

  1. 启动服务端cd mini-raft-server/deply && sh ./deploy.sh

  2. 启动客户端 mini-raft-client

    @SpringBootTest
    @RunWith(SpringRunner.class)
    public class CurdControllerTest extends TestCase
    {
    
        private MockMvc mockMvc;
    
        @Autowired
        private WebApplicationContext wac;
    
        @Before
        public void before()
        {
            this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
        }
    
        @Test
        public void getOp() throws Exception
        {
            String key = "hello00";
            MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/client/get").contentType(MediaType.APPLICATION_JSON).param("key", key)).andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print()).andReturn();
        }
    
        @Test
        public void putOp() throws Exception
        {
            String key = "hello00";
            String value = "world00";
            MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/client/put").contentType(MediaType.APPLICATION_JSON).param("key", key).param("value", value)).andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print()).andReturn();
        }
    }
    

标签:mini,String,key,mockMvc,raft,public,分布式
来源: https://www.cnblogs.com/miss-u/p/16148611.html