From 227dd3e1b1187dad96f78d75134abd18c6033903 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Sat, 9 May 2020 16:51:27 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E5=A4=84=E7=BD=AE=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=B5=8B=E8=AF=95=E5=A2=9E=E5=8A=A0=E5=9B=9E=E6=BB=9A?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E9=81=BF=E5=85=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?ID=E4=B8=8D=E5=81=9C=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dispose/controller/DeviceNodeInfoControllerQATest.java | 2 +- .../dispose/controller/DeviceNodeManagerControllerTest.java | 4 ++++ .../java/com/dispose/controller/TaskControllerQATest.java | 4 ++++ .../java/com/dispose/controller/TaskControllerSmokeTest.java | 4 ++++ src/test/java/com/dispose/controller/TaskControllerTest.java | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/dispose/controller/DeviceNodeInfoControllerQATest.java b/src/test/java/com/dispose/controller/DeviceNodeInfoControllerQATest.java index f5d90a9d..f8948182 100644 --- a/src/test/java/com/dispose/controller/DeviceNodeInfoControllerQATest.java +++ b/src/test/java/com/dispose/controller/DeviceNodeInfoControllerQATest.java @@ -81,7 +81,7 @@ public class DeviceNodeInfoControllerQATest extends InitTestEnvironment{ @Test public void a1_getVersionNormalOneExistDeviceTest() throws Exception { String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504," + - "\"msgContent\":\"{\\\"id\\\":[\\\"242\\\"]}\"}"; + "\"msgContent\":\"{\\\"id\\\":[\\\"1\\\"]}\"}"; String ver = mockMvc.perform(MockMvcRequestBuilders .post("/information/version") diff --git a/src/test/java/com/dispose/controller/DeviceNodeManagerControllerTest.java b/src/test/java/com/dispose/controller/DeviceNodeManagerControllerTest.java index e940c0cf..35ee43f9 100644 --- a/src/test/java/com/dispose/controller/DeviceNodeManagerControllerTest.java +++ b/src/test/java/com/dispose/controller/DeviceNodeManagerControllerTest.java @@ -25,9 +25,11 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; @@ -45,6 +47,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @FixMethodOrder(MethodSorters.NAME_ASCENDING) +@Transactional +@Rollback @Slf4j public class DeviceNodeManagerControllerTest extends InitTestEnvironment { /** diff --git a/src/test/java/com/dispose/controller/TaskControllerQATest.java b/src/test/java/com/dispose/controller/TaskControllerQATest.java index ed235a02..b0e3b6a1 100644 --- a/src/test/java/com/dispose/controller/TaskControllerQATest.java +++ b/src/test/java/com/dispose/controller/TaskControllerQATest.java @@ -17,9 +17,11 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; @@ -33,6 +35,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @FixMethodOrder(MethodSorters.NAME_ASCENDING) +@Transactional +@Rollback @Slf4j public class TaskControllerQATest extends InitTestEnvironment { /** diff --git a/src/test/java/com/dispose/controller/TaskControllerSmokeTest.java b/src/test/java/com/dispose/controller/TaskControllerSmokeTest.java index d187ba24..8c08e822 100644 --- a/src/test/java/com/dispose/controller/TaskControllerSmokeTest.java +++ b/src/test/java/com/dispose/controller/TaskControllerSmokeTest.java @@ -16,9 +16,11 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; @@ -32,6 +34,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @FixMethodOrder(MethodSorters.NAME_ASCENDING) +@Transactional +@Rollback @Slf4j public class TaskControllerSmokeTest extends InitTestEnvironment { /** diff --git a/src/test/java/com/dispose/controller/TaskControllerTest.java b/src/test/java/com/dispose/controller/TaskControllerTest.java index 5eedf5c0..975997b8 100644 --- a/src/test/java/com/dispose/controller/TaskControllerTest.java +++ b/src/test/java/com/dispose/controller/TaskControllerTest.java @@ -28,9 +28,11 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; @@ -48,6 +50,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @FixMethodOrder(MethodSorters.NAME_ASCENDING) +@Transactional +@Rollback public class TaskControllerTest extends InitTestEnvironment { /** * The Mock mvc.