@@ -48,7 +48,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.hawkbit</groupId>
|
||||
<artifactId>hawkbit-artifact-repository-filesystem</artifactId>
|
||||
<artifactId>hawkbit-artifact-fs</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- Database -->
|
||||
|
||||
@@ -17,13 +17,13 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.eclipse.hawkbit.ContextAware;
|
||||
import org.eclipse.hawkbit.artifact.ArtifactStorage;
|
||||
import org.eclipse.hawkbit.artifact.fs.FileArtifactProperties;
|
||||
import org.eclipse.hawkbit.artifact.fs.FileArtifactStorage;
|
||||
import org.eclipse.hawkbit.artifact.urlresolver.PropertyBasedArtifactUrlResolver;
|
||||
import org.eclipse.hawkbit.artifact.urlresolver.PropertyBasedArtifactUrlResolverProperties;
|
||||
import org.eclipse.hawkbit.tenancy.cache.TenantAwareCacheManager;
|
||||
import org.eclipse.hawkbit.im.authentication.Hierarchy;
|
||||
import org.eclipse.hawkbit.repository.artifact.ArtifactFilesystemProperties;
|
||||
import org.eclipse.hawkbit.repository.artifact.ArtifactFilesystemRepository;
|
||||
import org.eclipse.hawkbit.repository.artifact.ArtifactRepository;
|
||||
import org.eclipse.hawkbit.repository.artifact.urlhandler.ArtifactUrlHandlerProperties;
|
||||
import org.eclipse.hawkbit.repository.artifact.urlhandler.PropertyBasedArtifactUrlHandler;
|
||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||
import org.eclipse.hawkbit.repository.RolloutApprovalStrategy;
|
||||
import org.eclipse.hawkbit.repository.RolloutStatusCache;
|
||||
import org.eclipse.hawkbit.repository.event.ApplicationEventFilter;
|
||||
@@ -71,7 +71,7 @@ import org.springframework.security.concurrent.DelegatingSecurityContextSchedule
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties({
|
||||
DdiSecurityProperties.class, ArtifactUrlHandlerProperties.class, ArtifactFilesystemProperties.class,
|
||||
DdiSecurityProperties.class, PropertyBasedArtifactUrlResolverProperties.class, FileArtifactProperties.class,
|
||||
HawkbitSecurityProperties.class, ControllerPollProperties.class, TenantConfigurationProperties.class })
|
||||
@Profile("test")
|
||||
@EnableAutoConfiguration
|
||||
@@ -123,8 +123,8 @@ public class TestConfiguration implements AsyncConfigurer {
|
||||
}
|
||||
|
||||
@Bean
|
||||
ArtifactRepository artifactRepository(final ArtifactFilesystemProperties artifactFilesystemProperties) {
|
||||
return new ArtifactFilesystemRepository(artifactFilesystemProperties);
|
||||
ArtifactStorage artifactRepository(final FileArtifactProperties artifactFilesystemProperties) {
|
||||
return new FileArtifactStorage(artifactFilesystemProperties);
|
||||
}
|
||||
|
||||
/** @return the {@link org.eclipse.hawkbit.repository.test.util.SecurityContextSwitch} to be injected. */
|
||||
@@ -134,8 +134,9 @@ public class TestConfiguration implements AsyncConfigurer {
|
||||
}
|
||||
|
||||
@Bean
|
||||
PropertyBasedArtifactUrlHandler testPropertyBasedArtifactUrlHandler(final ArtifactUrlHandlerProperties urlHandlerProperties) {
|
||||
return new PropertyBasedArtifactUrlHandler(urlHandlerProperties, "");
|
||||
PropertyBasedArtifactUrlResolver testPropertyBasedArtifactUrlHandler(
|
||||
final PropertyBasedArtifactUrlResolverProperties urlHandlerProperties) {
|
||||
return new PropertyBasedArtifactUrlResolver(urlHandlerProperties, "");
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpPermission.READ_TENANT_CONFIGURATION;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpRole.SYSTEM_ROLE;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpRole.CONTROLLER_ROLE;
|
||||
import static org.eclipse.hawkbit.im.authentication.SpRole.SYSTEM_ROLE;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -29,10 +29,14 @@ import java.util.NoSuchElementException;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.awaitility.core.ConditionFactory;
|
||||
import org.eclipse.hawkbit.artifact.ArtifactStorage;
|
||||
import org.eclipse.hawkbit.artifact.exception.ArtifactStoreException;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.ConfirmationManagement;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
@@ -54,8 +58,6 @@ import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.artifact.ArtifactRepository;
|
||||
import org.eclipse.hawkbit.repository.artifact.exception.ArtifactStoreException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionStatusCreate;
|
||||
@@ -176,7 +178,7 @@ public abstract class AbstractIntegrationTest {
|
||||
@Autowired
|
||||
protected SystemSecurityContext systemSecurityContext;
|
||||
@Autowired
|
||||
protected ArtifactRepository binaryArtifactRepository;
|
||||
protected ArtifactStorage binaryArtifactRepository;
|
||||
@Autowired
|
||||
protected QuotaManagement quotaManagement;
|
||||
|
||||
@@ -521,6 +523,11 @@ public abstract class AbstractIntegrationTest {
|
||||
return targetManagement.findAll(pageable).stream().filter(target -> status.equals(target.getUpdateStatus())).toList();
|
||||
}
|
||||
|
||||
protected TargetType findTargetTypeByName(@NotEmpty String name) {
|
||||
return targetTypeManagement.findByRsql("name==" + name, UNPAGED).stream().findAny()
|
||||
.orElseThrow(() -> new EntityNotFoundException(TargetType.class, name));
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
protected static <T> Collection<T> concat(final Collection<T>... targets) {
|
||||
final List<T> result = new ArrayList<>();
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||
import org.eclipse.hawkbit.tenancy.cache.TenantAwareCacheManager;
|
||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.IntStream;
|
||||
@@ -241,7 +240,6 @@ public class TestdataFactory {
|
||||
return createDistributionSet(UUID.randomUUID().toString(), DEFAULT_VERSION, false);
|
||||
}
|
||||
|
||||
|
||||
public DistributionSet createDistributionSetLocked() {
|
||||
return distributionSetManagement.lock(createDistributionSet());
|
||||
}
|
||||
@@ -488,7 +486,7 @@ public class TestdataFactory {
|
||||
*/
|
||||
public Artifact createArtifact(final String artifactData, final Long moduleId, final String filename) {
|
||||
final InputStream stubInputStream = IOUtils.toInputStream(artifactData, StandardCharsets.UTF_8);
|
||||
return artifactManagement.create(new ArtifactUpload(stubInputStream, moduleId, filename, false, artifactData.length()));
|
||||
return artifactManagement.create(new ArtifactUpload(stubInputStream, null, artifactData.length(), null, moduleId, filename, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -502,7 +500,7 @@ public class TestdataFactory {
|
||||
*/
|
||||
public Artifact createArtifact(final byte[] artifactData, final Long moduleId, final String filename, final int fileSize) {
|
||||
return artifactManagement.create(
|
||||
new ArtifactUpload(new ByteArrayInputStream(artifactData), moduleId, filename, false, fileSize));
|
||||
new ArtifactUpload(new ByteArrayInputStream(artifactData), null, fileSize, null, moduleId, filename, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -637,7 +635,7 @@ public class TestdataFactory {
|
||||
SoftwareModuleManagement.Update.builder().id(module.getId()).description("Updated " + DEFAULT_DESCRIPTION).build()));
|
||||
|
||||
// load also lazy stuff
|
||||
return distributionSetManagement.getWithDetails(set.getId()).orElseThrow();
|
||||
return distributionSetManagement.getWithDetails(set.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1053,7 +1051,7 @@ public class TestdataFactory {
|
||||
// Run here, because Scheduler is disabled during tests
|
||||
rolloutHandleAll();
|
||||
|
||||
return rolloutManagement.find(rollout.getId()).orElseThrow();
|
||||
return rolloutManagement.get(rollout.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1178,7 +1176,9 @@ public class TestdataFactory {
|
||||
* @return persisted {@link TargetType}
|
||||
*/
|
||||
public TargetType findOrCreateTargetType(final String targetTypeName) {
|
||||
return targetTypeManagement.getByName(targetTypeName)
|
||||
return targetTypeManagement.findByRsql("name==" + targetTypeName, Pageable.unpaged())
|
||||
.stream().findAny()
|
||||
.map(TargetType.class::cast)
|
||||
.orElseGet(() -> targetTypeManagement.create(TargetTypeManagement.Create.builder()
|
||||
.name(targetTypeName).description(targetTypeName + SPACE_AND_DESCRIPTION)
|
||||
.key(targetTypeName + " key").colour(DEFAULT_COLOUR)
|
||||
@@ -1298,6 +1298,6 @@ public class TestdataFactory {
|
||||
}
|
||||
|
||||
private Rollout reloadRollout(final Rollout rollout) {
|
||||
return rolloutManagement.find(rollout.getId()).orElseThrow(NoSuchElementException::new);
|
||||
return rolloutManagement.get(rollout.getId());
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ hawkbit.artifact.url.protocols.download-http.ip=127.0.0.1
|
||||
hawkbit.artifact.url.protocols.download-http.protocol=http
|
||||
hawkbit.artifact.url.protocols.download-http.port=8080
|
||||
hawkbit.artifact.url.protocols.download-http.supports=DMF,DDI
|
||||
hawkbit.artifact.url.protocols.download-http.ref={protocol}://{hostnameRequest}:{portRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}/download
|
||||
hawkbit.artifact.url.protocols.download-http.ref={protocolRequest}://{hostnameRequest}:{portRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}
|
||||
hawkbit.artifact.url.protocols.md5sum-http.rel=md5sum-http
|
||||
hawkbit.artifact.url.protocols.md5sum-http.protocol=${hawkbit.artifact.url.protocols.download-http.protocol}
|
||||
hawkbit.artifact.url.protocols.md5sum-http.hostname=${hawkbit.artifact.url.protocols.download-http.hostname}
|
||||
@@ -59,6 +59,7 @@ hawkbit.artifact.url.protocols.download-cdn-http.port=8080
|
||||
hawkbit.artifact.url.protocols.download-cdn-http.supports=MGMT
|
||||
hawkbit.artifact.url.protocols.download-cdn-http.ref={protocol}://download-cdn.com/artifacts/{artifactFileName}/download
|
||||
## Download URL Generation - END
|
||||
## Download URL Generation - END
|
||||
|
||||
# Quota - START
|
||||
hawkbit.server.security.dos.maxStatusEntriesPerAction=10
|
||||
|
||||
Reference in New Issue
Block a user