Refactor RabbitMQ configuration (#2519)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -26,12 +26,6 @@ The Management API can be accessed via http://localhost:8080/rest/v1
|
||||
|
||||
Clustering in hawkBit is based on _Spring Cloud Bus_. It is not enabled in the example app by default.
|
||||
|
||||
Add to your `application.properties` :
|
||||
|
||||
```properties
|
||||
spring.cloud.bus.enabled=true
|
||||
```
|
||||
|
||||
Add to your `pom.xml` :
|
||||
|
||||
```xml
|
||||
|
||||
@@ -45,12 +45,14 @@ hawkbit.cache.global.ttl=0
|
||||
# Optional events
|
||||
hawkbit.server.repository.publish-target-poll-event=false
|
||||
|
||||
## Configuration for DMF/RabbitMQ integration
|
||||
spring.rabbitmq.username=guest
|
||||
spring.rabbitmq.password=guest
|
||||
spring.rabbitmq.virtual-host=/
|
||||
spring.rabbitmq.host=localhost
|
||||
spring.rabbitmq.port=5672
|
||||
## Disable RabbitMQ auto configuration. Comment it to enable RabbitMQ support.
|
||||
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration
|
||||
## Configuration Spring Bus (disabled by default) - no cluster support. To enable it, enable RabbitMQ (see above)
|
||||
## and comment the line (spring.cloud.bus.enabled=false) or set spring.cloud.bus.enabled=true
|
||||
spring.cloud.bus.enabled=false
|
||||
## Disable DMF (by default) - no DMF support. To enable it, enable RabbitMQ (see above) and comment the line
|
||||
## (hawkbit.dmf.rabbitmq.enabled=false) set hawkbit.dmf.rabbitmq.enabled=true
|
||||
hawkbit.dmf.enabled=false
|
||||
|
||||
# Enable CORS and specify the allowed origins:
|
||||
#hawkbit.server.security.cors.enabled=true
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
@SpringBootTest(properties = { "hawkbit.dmf.rabbitmq.enabled=false" })
|
||||
@SpringBootTest
|
||||
@ExtendWith(SharedSqlTestDatabaseExtension.class)
|
||||
public abstract class AbstractSecurityTest {
|
||||
abstract class AbstractSecurityTest {
|
||||
|
||||
protected MockMvc mvc;
|
||||
@Autowired
|
||||
|
||||
@@ -16,14 +16,14 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@TestPropertySource(properties = {
|
||||
"hawkbit.server.security.allowedHostNames=localhost",
|
||||
"hawkbit.server.security.httpFirewallIgnoredPaths=/index.html"
|
||||
})
|
||||
/**
|
||||
* Feature: Integration Test - Security<br/>
|
||||
* Story: Allowed Host Names
|
||||
*/
|
||||
@TestPropertySource(properties = {
|
||||
"hawkbit.server.security.allowedHostNames=localhost",
|
||||
"hawkbit.server.security.httpFirewallIgnoredPaths=/index.html"
|
||||
})
|
||||
class AllowedHostNamesTest extends AbstractSecurityTest {
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,19 +22,18 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
|
||||
/**
|
||||
* Feature: Integration Test - Security<br/>
|
||||
* Story: CORS
|
||||
*/
|
||||
@SpringBootTest(
|
||||
properties = {
|
||||
"hawkbit.dmf.rabbitmq.enabled=false",
|
||||
"hawkbit.server.security.cors.enabled=true",
|
||||
"hawkbit.server.security.cors.allowedOrigins=" +
|
||||
CorsTest.ALLOWED_ORIGIN_FIRST + "," +
|
||||
CorsTest.ALLOWED_ORIGIN_SECOND,
|
||||
"hawkbit.server.security.cors.exposedHeaders=" +
|
||||
HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN })
|
||||
/**
|
||||
* Feature: Integration Test - Security<br/>
|
||||
* Story: CORS
|
||||
*/
|
||||
class CorsTest extends AbstractSecurityTest {
|
||||
|
||||
static final String ALLOWED_ORIGIN_FIRST = "http://test.first.origin";
|
||||
|
||||
Reference in New Issue
Block a user