|
7 | 7 |
|
8 | 8 | import ch.cyberduck.core.PasswordStoreFactory; |
9 | 9 |
|
| 10 | +import cloud.katta.client.model.StorageProfileS3Dto; |
| 11 | + |
10 | 12 | import org.apache.logging.log4j.LogManager; |
11 | 13 | import org.apache.logging.log4j.Logger; |
12 | 14 | import org.junit.jupiter.api.Test; |
13 | 15 | import org.testcontainers.containers.ComposeContainer; |
14 | 16 |
|
| 17 | +import cloud.katta.client.api.StorageProfileResourceApi; |
15 | 18 | import cloud.katta.protocols.hub.HubSession; |
16 | 19 | import cloud.katta.testsetup.HubTestConfig; |
17 | 20 |
|
| 21 | +import static org.junit.Assert.assertFalse; |
| 22 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
| 23 | + |
| 24 | +import java.util.List; |
| 25 | +import java.util.Optional; |
| 26 | + |
18 | 27 | class StorageProfileArchiveIT extends AbtractAdminCliIT { |
19 | 28 | private static final Logger log = LogManager.getLogger(StorageProfileArchiveIT.class.getName()); |
20 | 29 | public static ComposeContainer compose; |
21 | 30 |
|
22 | 31 |
|
23 | 32 | @Test |
24 | | - public void testHubWorkflow() throws Exception { |
| 33 | + public void testStorageProfileArchive() throws Exception { |
25 | 34 | HubTestConfig.Setup config = new HubTestConfig.Setup().withUserConfig( |
26 | 35 | new HubTestConfig.Setup.UserConfig("admin", "admin", "setupcode") |
27 | 36 | ).withHubURL("http://localhost:8280"); |
28 | 37 | final HubSession hubSession = setupConnection(config); |
29 | 38 | final String accessToken = PasswordStoreFactory.get().findOAuthTokens(hubSession.getHost()).getAccessToken(); |
30 | 39 |
|
31 | | - new StorageProfileArchive().call("http://localhost:8280", accessToken, "732D43FA-3716-46C4-B931-66EA5405EF1C"); |
| 40 | + |
| 41 | + final String storageProfileId = "732D43FA-3716-46C4-B931-66EA5405EF1C".toLowerCase(); |
| 42 | + final StorageProfileResourceApi storageProfileResourceApi = new StorageProfileResourceApi(hubSession.getClient()); |
| 43 | + { |
| 44 | + final Optional<StorageProfileS3Dto> profile = storageProfileResourceApi.apiStorageprofileS3Get().stream().filter(p -> p.getId().toString().toLowerCase().equals(storageProfileId)).findFirst(); |
| 45 | + assertTrue(profile.isPresent()); |
| 46 | + assertFalse(profile.get().getArchived()); |
| 47 | + } |
| 48 | + new StorageProfileArchive().call("http://localhost:8280", accessToken, storageProfileId); |
| 49 | + { |
| 50 | + final Optional<StorageProfileS3Dto> profile = storageProfileResourceApi.apiStorageprofileS3Get().stream().filter(p -> p.getId().toString().toLowerCase().equals(storageProfileId)).findFirst(); |
| 51 | + assertTrue(profile.isPresent()); |
| 52 | + assertTrue(profile.get().getArchived()); |
| 53 | + } |
32 | 54 | } |
33 | 55 | } |
0 commit comments