Refactoring/Improving source: artifactory-fs (#1606)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-03 18:02:21 +02:00
committed by GitHub
parent f8b1910d02
commit d388b8afdd
2 changed files with 6 additions and 13 deletions

View File

@@ -9,12 +9,14 @@
*/ */
package org.eclipse.hawkbit.artifact.repository; package org.eclipse.hawkbit.artifact.repository;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
/** /**
* Configuration properties for the file-system repository, e.g. the base-path * Configuration properties for the file-system repository, e.g. the base-path
* to store the files. * to store the files.
*/ */
@Data
@ConfigurationProperties("org.eclipse.hawkbit.repository.file") @ConfigurationProperties("org.eclipse.hawkbit.repository.file")
public class ArtifactFilesystemProperties { public class ArtifactFilesystemProperties {
@@ -22,12 +24,4 @@ public class ArtifactFilesystemProperties {
* The base-path of the directory to store the artifacts. * The base-path of the directory to store the artifacts.
*/ */
private String path = "./artifactrepo"; private String path = "./artifactrepo";
}
public String getPath() {
return path;
}
public void setPath(final String path) {
this.path = path;
}
}

View File

@@ -17,6 +17,7 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.Random; import java.util.Random;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.assertj.core.api.Assertions; import org.assertj.core.api.Assertions;
@@ -24,17 +25,15 @@ import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.qameta.allure.Description; 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;
@Slf4j
@Feature("Unit Tests - Artifact File System Repository") @Feature("Unit Tests - Artifact File System Repository")
@Story("Test storing artifact binaries in the file-system") @Story("Test storing artifact binaries in the file-system")
public class ArtifactFilesystemRepositoryTest { public class ArtifactFilesystemRepositoryTest {
private static final Logger LOG = LoggerFactory.getLogger(ArtifactFilesystemRepositoryTest.class);
private static final String TENANT = "test_tenant"; private static final String TENANT = "test_tenant";
@@ -56,7 +55,7 @@ public class ArtifactFilesystemRepositoryTest {
try { try {
FileUtils.deleteDirectory(new File(artifactResourceProperties.getPath())); FileUtils.deleteDirectory(new File(artifactResourceProperties.getPath()));
} catch (final IOException | IllegalArgumentException e) { } catch (final IOException | IllegalArgumentException e) {
LOG.warn("Cannot delete file-directory", e); log.warn("Cannot delete file-directory", e);
} }
} }
} }