Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
lizk886 committed Jul 16, 2024
1 parent 42fd344 commit f129cb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import com.uid2.shared.cloud.DownloadCloudStorage;
import com.uid2.shared.model.KeysetKey;
import com.uid2.shared.store.*;
import com.uid2.shared.store.CloudPath;
import com.uid2.shared.store.IKeysetKeyStore;
import com.uid2.shared.store.KeysetKeyStoreSnapshot;
import com.uid2.shared.store.ScopedStoreReader;
import com.uid2.shared.store.parser.KeysetKeyParser;
import com.uid2.shared.store.scope.EncryptedScope;
import com.uid2.shared.store.scope.StoreScope;
import com.uid2.shared.store.EncryptedScopedStoreReader;
import io.vertx.core.json.JsonObject;

import java.time.Instant;
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/com/uid2/shared/store/scope/EncryptedScope.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@

package com.uid2.shared.store.scope;


import com.uid2.shared.store.CloudPath;

public class EncryptedScope implements StoreScope {
private final Integer siteId;
private final CloudPath rootMetadataPath;
private final boolean isPublic;

public EncryptedScope(CloudPath rootMetadataPath, Integer siteId, boolean isPublic){
this.rootMetadataPath = rootMetadataPath;
this.siteId = siteId;
this.isPublic = isPublic;
}
private final Integer siteId;
private final CloudPath rootMetadataPath;
private final boolean isPublic;

@Override
public CloudPath getMetadataPath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,22 @@ class EncryptedScopeTest {
void getMetadataPath() {
EncryptedScope scope = new EncryptedScope(new CloudPath("/original/path/metadata.json"), 5,false);
CloudPath expected = new CloudPath("/original/path/encrypted/5_private/metadata.json");

CloudPath actual = scope.getMetadataPath();
assertThat(actual).isEqualTo(expected);
}

@Test
void resolvesPathsRelativeToSiteDirectory() {
EncryptedScope scope = new EncryptedScope(new CloudPath("/original/path/metadata.json"), 5,false );
CloudPath actual = scope.resolve(new CloudPath("file.xyz"));
CloudPath expected = new CloudPath("/original/path/encrypted/5_private/file.xyz");
CloudPath actual = scope.resolve(new CloudPath("file.xyz"));
assertThat(actual).isEqualTo(expected);
}

@Test
void getMetadataPathPublic() {
EncryptedScope scope = new EncryptedScope(new CloudPath("/original/path/metadata.json"), 5, true);
CloudPath expected = new CloudPath("/original/path/encrypted/5_public/metadata.json");

CloudPath actual = scope.getMetadataPath();
assertThat(actual).isEqualTo(expected);
}
Expand Down

0 comments on commit f129cb0

Please sign in to comment.