Skip to content

Commit 7f8649f

Browse files
committed
Add storage profile AWS static setup test.
1 parent f1939b2 commit 7f8649f

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

admin-cli/src/main/java/cloud/katta/cli/commands/setup/StorageProfileAwsStaticSetup.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public class StorageProfileAwsStaticSetup extends AbstractStorageProfile {
3030
protected void call(final UUID uuid, final ApiClient apiClient) throws ApiException {
3131
final StorageProfileResourceApi storageProfileResourceApi = new StorageProfileResourceApi(apiClient);
3232

33+
call(uuid, storageProfileResourceApi);
34+
}
35+
36+
protected void call(UUID uuid, StorageProfileResourceApi storageProfileResourceApi) throws ApiException {
3337
storageProfileResourceApi.apiStorageprofileS3Put(new StorageProfileS3Dto()
3438
.id(uuid)
3539
.name("AWS S3 static")
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2025 shift7 GmbH. All rights reserved.
3+
*/
4+
5+
package cloud.katta.cli.commands.setup;
6+
7+
import org.junit.jupiter.api.Test;
8+
import org.mockito.Mockito;
9+
10+
import java.util.UUID;
11+
12+
import cloud.katta.client.ApiException;
13+
import cloud.katta.client.api.StorageProfileResourceApi;
14+
import cloud.katta.client.model.Protocol;
15+
import cloud.katta.client.model.S3STORAGECLASSES;
16+
import cloud.katta.client.model.StorageProfileS3Dto;
17+
18+
import static org.mockito.ArgumentMatchers.any;
19+
import static org.mockito.Mockito.times;
20+
21+
class StorageProfileAwsStaticSetupTest {
22+
@Test
23+
public void testCall() throws ApiException {
24+
final StorageProfileResourceApi api = Mockito.mock(StorageProfileResourceApi.class);
25+
final UUID vaultId = UUID.randomUUID();
26+
final StorageProfileAwsStaticSetup cli = new StorageProfileAwsStaticSetup();
27+
cli.call(vaultId, api);
28+
29+
final StorageProfileS3Dto dto = new StorageProfileS3Dto();
30+
dto.setId(vaultId);
31+
dto.setName("AWS S3 static");
32+
dto.setProtocol(Protocol.S3);
33+
dto.setArchived(false);
34+
dto.setScheme("https");
35+
dto.setPort(443);
36+
dto.setWithPathStyleAccessEnabled(false);
37+
dto.setStorageClass(S3STORAGECLASSES.STANDARD);
38+
Mockito.verify(api, times(1)).apiStorageprofileS3Put(dto);
39+
Mockito.verify(api, times(1)).apiStorageprofileS3Put(any());
40+
}
41+
}

0 commit comments

Comments
 (0)