Fix test properties
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -9,11 +9,13 @@
|
|||||||
package org.eclipse.hawkbit;
|
package org.eclipse.hawkbit;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Properties for the server e.g. the server's URL which must be configured.
|
* Properties for the server e.g. the server's URL which must be configured.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Component
|
||||||
@ConfigurationProperties("hawkbit.server")
|
@ConfigurationProperties("hawkbit.server")
|
||||||
public class HawkbitServerProperties {
|
public class HawkbitServerProperties {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class TenantConfigurationPollingDurationValidator implements TenantConfig
|
|||||||
private final Duration maxDuration;
|
private final Duration maxDuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
* @param properties
|
* @param properties
|
||||||
* property accessor for poll configuration
|
* property accessor for poll configuration
|
||||||
*/
|
*/
|
||||||
@@ -46,7 +48,6 @@ public class TenantConfigurationPollingDurationValidator implements TenantConfig
|
|||||||
final Duration tenantConfigurationValue;
|
final Duration tenantConfigurationValue;
|
||||||
try {
|
try {
|
||||||
tenantConfigurationValue = durationHelper.formattedStringToDuration(tenantConfigurationString);
|
tenantConfigurationValue = durationHelper.formattedStringToDuration(tenantConfigurationString);
|
||||||
|
|
||||||
} catch (final DateTimeParseException ex) {
|
} catch (final DateTimeParseException ex) {
|
||||||
throw new TenantConfigurationValidatorException(
|
throw new TenantConfigurationValidatorException(
|
||||||
String.format("The given configuration value is expected as a string in the format %s.",
|
String.format("The given configuration value is expected as a string in the format %s.",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
|||||||
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.DdiSecurityProperties.Rp;
|
import org.eclipse.hawkbit.security.DdiSecurityProperties.Rp;
|
||||||
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
||||||
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -93,7 +94,10 @@ public class AmqpControllerAuthenticationTest {
|
|||||||
authenticationManager.setControllerManagement(controllerManagement);
|
authenticationManager.setControllerManagement(controllerManagement);
|
||||||
amqpMessageHandlerService.setArtifactManagement(mock(ArtifactManagement.class));
|
amqpMessageHandlerService.setArtifactManagement(mock(ArtifactManagement.class));
|
||||||
|
|
||||||
authenticationManager.setTenantAware(new SecurityContextTenantAware());
|
final SecurityContextTenantAware tenantAware = new SecurityContextTenantAware();
|
||||||
|
authenticationManager.setTenantAware(tenantAware);
|
||||||
|
final SystemSecurityContext systemSecurityContext = new SystemSecurityContext(tenantAware);
|
||||||
|
authenticationManager.setSystemSecurityContext(systemSecurityContext);
|
||||||
authenticationManager.postConstruct();
|
authenticationManager.postConstruct();
|
||||||
amqpMessageHandlerService.setAuthenticationManager(authenticationManager);
|
amqpMessageHandlerService.setAuthenticationManager(authenticationManager);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ public class HttpControllerPreAuthenticatedGatewaySecurityTokenFilter
|
|||||||
* @param tenantConfigurationManagement
|
* @param tenantConfigurationManagement
|
||||||
* the system management service to retrieve configuration
|
* the system management service to retrieve configuration
|
||||||
* properties
|
* properties
|
||||||
* @param systemManagement
|
|
||||||
* the system management service to retrieve configuration
|
|
||||||
* properties
|
|
||||||
* @param tenantAware
|
* @param tenantAware
|
||||||
* the tenant aware service to get configuration for the specific
|
* the tenant aware service to get configuration for the specific
|
||||||
* tenant
|
* tenant
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import com.mongodb.MongoClientOptions;
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableGlobalMethodSecurity(prePostEnabled = true, mode = AdviceMode.ASPECTJ, proxyTargetClass = true, securedEnabled = true)
|
@EnableGlobalMethodSecurity(prePostEnabled = true, mode = AdviceMode.ASPECTJ, proxyTargetClass = true, securedEnabled = true)
|
||||||
@EnableConfigurationProperties({ DdiSecurityProperties.class, ControllerPollProperties.class })
|
@EnableConfigurationProperties({ DdiSecurityProperties.class })
|
||||||
@Profile("test")
|
@Profile("test")
|
||||||
public class TestConfiguration implements AsyncConfigurer {
|
public class TestConfiguration implements AsyncConfigurer {
|
||||||
|
|
||||||
|
|||||||
@@ -59,15 +59,12 @@ public class DurationConfigField extends GridLayout implements ValueChangeListen
|
|||||||
if (event.getProperty() != checkBox) {
|
if (event.getProperty() != checkBox) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
durationField.setEnabled(checkBox.getValue());
|
durationField.setEnabled(checkBox.getValue());
|
||||||
|
|
||||||
if (!checkBox.getValue()) {
|
if (!checkBox.getValue()) {
|
||||||
durationField.setDuration(globalDuration);
|
durationField.setDuration(globalDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
durationField.setEnabled(false);
|
|
||||||
|
|
||||||
notifyConfigurationChanged();
|
notifyConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user