Fix test properties

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-03-09 15:36:59 +01:00
parent ed97031faf
commit a4cc3df092
6 changed files with 10 additions and 9 deletions

View File

@@ -9,11 +9,13 @@
package org.eclipse.hawkbit;
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.
*
*/
@Component
@ConfigurationProperties("hawkbit.server")
public class HawkbitServerProperties {
/**

View File

@@ -29,6 +29,8 @@ public class TenantConfigurationPollingDurationValidator implements TenantConfig
private final Duration maxDuration;
/**
* Constructor.
*
* @param properties
* property accessor for poll configuration
*/
@@ -46,7 +48,6 @@ public class TenantConfigurationPollingDurationValidator implements TenantConfig
final Duration tenantConfigurationValue;
try {
tenantConfigurationValue = durationHelper.formattedStringToDuration(tenantConfigurationString);
} catch (final DateTimeParseException ex) {
throw new TenantConfigurationValidatorException(
String.format("The given configuration value is expected as a string in the format %s.",

View File

@@ -27,6 +27,7 @@ import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
import org.eclipse.hawkbit.security.DdiSecurityProperties;
import org.eclipse.hawkbit.security.DdiSecurityProperties.Rp;
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.junit.Before;
import org.junit.Test;
@@ -93,7 +94,10 @@ public class AmqpControllerAuthenticationTest {
authenticationManager.setControllerManagement(controllerManagement);
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();
amqpMessageHandlerService.setAuthenticationManager(authenticationManager);
}

View File

@@ -30,9 +30,6 @@ public class HttpControllerPreAuthenticatedGatewaySecurityTokenFilter
* @param tenantConfigurationManagement
* the system management service to retrieve configuration
* properties
* @param systemManagement
* the system management service to retrieve configuration
* properties
* @param tenantAware
* the tenant aware service to get configuration for the specific
* tenant

View File

@@ -47,7 +47,7 @@ import com.mongodb.MongoClientOptions;
*/
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, mode = AdviceMode.ASPECTJ, proxyTargetClass = true, securedEnabled = true)
@EnableConfigurationProperties({ DdiSecurityProperties.class, ControllerPollProperties.class })
@EnableConfigurationProperties({ DdiSecurityProperties.class })
@Profile("test")
public class TestConfiguration implements AsyncConfigurer {

View File

@@ -59,15 +59,12 @@ public class DurationConfigField extends GridLayout implements ValueChangeListen
if (event.getProperty() != checkBox) {
return;
}
durationField.setEnabled(checkBox.getValue());
if (!checkBox.getValue()) {
durationField.setDuration(globalDuration);
}
durationField.setEnabled(false);
notifyConfigurationChanged();
}