diff --git a/services/node_manager/src/main/resources/application.properties b/services/node_manager/src/main/resources/application.properties index a5e45f7a3..36e669569 100644 --- a/services/node_manager/src/main/resources/application.properties +++ b/services/node_manager/src/main/resources/application.properties @@ -1,6 +1,9 @@ +#redis configuration +spring.redis.host=localhost +spring.redis.port=6380 #ignite configuration ignite.host=localhost -ignite.port=10800 +ignite.port=10801 ignite.key-store-path=keystore.jks ignite.key-store-password=123456 ignite.trust-store-path=truststore.jks diff --git a/services/node_manager/src/test/java/com/futurewei/alcor/nodemanager/controller/NodeControllerTest.java b/services/node_manager/src/test/java/com/futurewei/alcor/nodemanager/controller/NodeControllerTest.java index 4ef156919..8f07a91be 100644 --- a/services/node_manager/src/test/java/com/futurewei/alcor/nodemanager/controller/NodeControllerTest.java +++ b/services/node_manager/src/test/java/com/futurewei/alcor/nodemanager/controller/NodeControllerTest.java @@ -15,6 +15,7 @@ package com.futurewei.alcor.nodemanager.controller; import com.fasterxml.jackson.databind.ObjectMapper; +import com.futurewei.alcor.common.db.ignite.MockIgniteServer; import com.futurewei.alcor.common.exception.ParameterUnexpectedValueException; import com.futurewei.alcor.nodemanager.service.NodeService; import com.futurewei.alcor.web.entity.NodeInfo; @@ -35,7 +36,9 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import static org.junit.Assert.assertTrue; +import java.util.Objects; + +import static org.junit.Assert.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -43,7 +46,7 @@ @RunWith(SpringRunner.class) @SpringBootTest() @AutoConfigureMockMvc -public class NodeControllerTest { +public class NodeControllerTest extends MockIgniteServer { private static final ObjectMapper om = new ObjectMapper(); @MockBean NodeService service; @@ -125,7 +128,7 @@ public void test_createNodeInfo_invalidInputNull() throws Exception { .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isBadRequest()) - .andExpect((rslt) -> assertTrue(rslt.getResolvedException().getClass() != null)); + .andExpect((rslt) -> assertNotNull(Objects.requireNonNull(rslt.getResolvedException()).getClass())); } @Test @@ -182,7 +185,7 @@ public void test_getNodeInfoByNodeId_invalidId() throws Exception { MvcResult result = this.mockMvc.perform(get("/nodes/" + strNodeId)) .andDo(print()) .andReturn(); - assertTrue(result.getResponse().getContentAsString().length() == 0); + assertEquals(0, result.getResponse().getContentAsString().length()); } @Test @@ -193,7 +196,7 @@ public void deleteNodeInfo() throws Exception { .andDo(print()) .andExpect(status().isOk()) .andReturn(); - assertTrue(result.getResponse().getContentAsString().equals(strNodeId)); + assertEquals(result.getResponse().getContentAsString(), strNodeId); } @Test @@ -202,6 +205,6 @@ public void deleteNodeInfo_invalidId() throws Exception { MvcResult result = this.mockMvc.perform(delete("/nodes/" + strNodeId)) .andDo(print()) .andReturn(); - assertTrue(result.getResponse().getContentAsString().length() == 0); + assertEquals(0, result.getResponse().getContentAsString().length()); } } \ No newline at end of file