Improve WithUser testing (#2943)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-02-27 12:59:13 +02:00
committed by GitHub
parent f2318078bd
commit 5d043b2766
19 changed files with 161 additions and 203 deletions

View File

@@ -42,6 +42,7 @@ import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import org.eclipse.hawkbit.auth.SpRole;
import org.eclipse.hawkbit.ddi.rest.resource.DdiArtifactDownloadTest.DownloadTestConfiguration;
import org.eclipse.hawkbit.repository.event.remote.DownloadProgressEvent;
import org.eclipse.hawkbit.repository.model.Artifact;
@@ -157,7 +158,7 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
* Tests valid downloads through the artifact resource by identifying the artifact not by ID but file name.
*/
@Test
@WithUser(principal = "4712", authorities = "ROLE_CONTROLLER", allSpPermissions = true)
@WithUser(principal = "4712", authorities = { SpRole.CONTROLLER_ROLE, SpRole.TENANT_ADMIN })
void downloadArtifactThroughFileName() throws Exception {
synchronized (DdiArtifactDownloadTest.class) {
downloadProgress = 1;
@@ -231,7 +232,7 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
* Test various HTTP range requests for artifact download, e.g. chunk download or download resume.
*/
@Test
@WithUser(principal = TestdataFactory.DEFAULT_CONTROLLER_ID, authorities = "ROLE_CONTROLLER", allSpPermissions = true)
@WithUser(principal = TestdataFactory.DEFAULT_CONTROLLER_ID, authorities = { SpRole.CONTROLLER_ROLE, SpRole.TENANT_ADMIN })
void rangeDownloadArtifact() throws Exception {
// create target
final Target target = testdataFactory.createTarget();

View File

@@ -18,7 +18,7 @@ import org.json.JSONException;
import org.json.JSONObject;
/**
* Builder class for building certain json strings.
* Builder class for building certain JSON strings.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Slf4j