Web env none in tests where not needed (#1871)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -69,7 +69,7 @@ import io.qameta.allure.Story;
|
|||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@Feature("Component Tests - Device Management Federation API")
|
@Feature("Component Tests - Device Management Federation API")
|
||||||
@Story("AmqpMessage Dispatcher Service Test")
|
@Story("AmqpMessage Dispatcher Service Test")
|
||||||
@SpringBootTest(classes = { RepositoryApplicationConfiguration.class })
|
@SpringBootTest(classes = { RepositoryApplicationConfiguration.class }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||||
class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
|
class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
private static final String TENANT = "default";
|
private static final String TENANT = "default";
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import io.qameta.allure.Story;
|
|||||||
|
|
||||||
@Feature("Component Tests - Repository")
|
@Feature("Component Tests - Repository")
|
||||||
@Story("Entity Events")
|
@Story("Entity Events")
|
||||||
@SpringBootTest(classes = { RepositoryTestConfiguration.class })
|
@SpringBootTest(classes = { RepositoryTestConfiguration.class }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||||
public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ import org.springframework.test.context.TestPropertySource;
|
|||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@ExtendWith({ JUnitTestLoggerExtension.class , SharedSqlTestDatabaseExtension.class })
|
@ExtendWith({ JUnitTestLoggerExtension.class , SharedSqlTestDatabaseExtension.class })
|
||||||
@WithUser(principal = "bumlux", allSpPermissions = true, authorities = { CONTROLLER_ROLE, SYSTEM_ROLE })
|
@WithUser(principal = "bumlux", allSpPermissions = true, authorities = { CONTROLLER_ROLE, SYSTEM_ROLE })
|
||||||
@SpringBootTest
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||||
@ContextConfiguration(classes = { TestConfiguration.class})
|
@ContextConfiguration(classes = { TestConfiguration.class})
|
||||||
@Import(TestChannelBinderConfiguration.class)
|
@Import(TestChannelBinderConfiguration.class)
|
||||||
// destroy the context after each test class because otherwise we get problem
|
// destroy the context after each test class because otherwise we get problem
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import org.eclipse.hawkbit.rest.filter.ExcludePathAwareShallowETagFilter;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
@@ -29,10 +30,11 @@ import org.springframework.web.filter.CharacterEncodingFilter;
|
|||||||
/**
|
/**
|
||||||
* Abstract Test for Rest tests.
|
* Abstract Test for Rest tests.
|
||||||
*/
|
*/
|
||||||
@WebAppConfiguration
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK)
|
||||||
@ContextConfiguration(classes = {
|
@ContextConfiguration(classes = {
|
||||||
RestConfiguration.class, RepositoryApplicationConfiguration.class, TestConfiguration.class})
|
RestConfiguration.class, RepositoryApplicationConfiguration.class, TestConfiguration.class})
|
||||||
@Import(TestChannelBinderConfiguration.class)
|
@Import(TestChannelBinderConfiguration.class)
|
||||||
|
@WebAppConfiguration
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTest {
|
public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,15 @@ import io.qameta.allure.Description;
|
|||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
import io.qameta.allure.Story;
|
import io.qameta.allure.Story;
|
||||||
|
|
||||||
@SpringBootTest(properties = {
|
@SpringBootTest(
|
||||||
|
properties = {
|
||||||
"hawkbit.dmf.rabbitmq.enabled=false",
|
"hawkbit.dmf.rabbitmq.enabled=false",
|
||||||
"hawkbit.server.security.cors.enabled=true",
|
"hawkbit.server.security.cors.enabled=true",
|
||||||
"hawkbit.server.security.cors.allowedOrigins="
|
"hawkbit.server.security.cors.allowedOrigins=" +
|
||||||
+ CorsTest.ALLOWED_ORIGIN_FIRST + ","
|
CorsTest.ALLOWED_ORIGIN_FIRST + "," +
|
||||||
+ CorsTest.ALLOWED_ORIGIN_SECOND,
|
CorsTest.ALLOWED_ORIGIN_SECOND,
|
||||||
"hawkbit.server.security.cors.exposedHeaders="
|
"hawkbit.server.security.cors.exposedHeaders=" +
|
||||||
+ HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN})
|
HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN})
|
||||||
@Feature("Integration Test - Security")
|
@Feature("Integration Test - Security")
|
||||||
@Story("CORS")
|
@Story("CORS")
|
||||||
public class CorsTest extends AbstractSecurityTest {
|
public class CorsTest extends AbstractSecurityTest {
|
||||||
|
|||||||
@@ -27,14 +27,15 @@ import io.qameta.allure.Description;
|
|||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
import io.qameta.allure.Story;
|
import io.qameta.allure.Story;
|
||||||
|
|
||||||
@SpringBootTest(properties = {
|
@SpringBootTest(
|
||||||
|
properties = {
|
||||||
"hawkbit.dmf.rabbitmq.enabled=false",
|
"hawkbit.dmf.rabbitmq.enabled=false",
|
||||||
"hawkbit.server.security.cors.enabled=true",
|
"hawkbit.server.security.cors.enabled=true",
|
||||||
"hawkbit.server.security.cors.allowedOrigins="
|
"hawkbit.server.security.cors.allowedOrigins=" +
|
||||||
+ CorsTest.ALLOWED_ORIGIN_FIRST + ","
|
CorsTest.ALLOWED_ORIGIN_FIRST + "," +
|
||||||
+ CorsTest.ALLOWED_ORIGIN_SECOND,
|
CorsTest.ALLOWED_ORIGIN_SECOND,
|
||||||
"hawkbit.server.security.cors.exposedHeaders="
|
"hawkbit.server.security.cors.exposedHeaders=" +
|
||||||
+ HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN})
|
HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN})
|
||||||
@Feature("Integration Test - Security")
|
@Feature("Integration Test - Security")
|
||||||
@Story("CORS")
|
@Story("CORS")
|
||||||
public class CorsTest extends AbstractSecurityTest {
|
public class CorsTest extends AbstractSecurityTest {
|
||||||
|
|||||||
Reference in New Issue
Block a user