Skip to content

Commit

Permalink
Adding new shared and fixing bad file name
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-constine-ttd committed Dec 11, 2024
1 parent 1653bf0 commit 18b99bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- check micrometer.version vertx-micrometer-metrics consumes before bumping up -->
<micrometer.version>1.12.2</micrometer.version>
<junit-jupiter.version>5.11.2</junit-jupiter.version>
<uid2-shared.version>8.0.11-alpha-173-SNAPSHOT</uid2-shared.version>
<uid2-shared.version>8.0.12-alpha-174-SNAPSHOT</uid2-shared.version>
<okta-jwt.version>0.5.10</okta-jwt.version>
<image.version>${project.version}</image.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.uid2.admin.store.FileManager;
import com.uid2.admin.store.version.VersionGenerator;
import com.uid2.admin.store.writer.EncyptedSaltStoreWriter;
import com.uid2.admin.store.writer.EncryptedSaltStoreWriter;
import com.uid2.admin.store.writer.StoreWriter;
import com.uid2.shared.Const;
import com.uid2.shared.cloud.TaggableCloudStorage;
Expand Down Expand Up @@ -44,7 +44,7 @@ public StoreWriter<Collection<RotatingSaltProvider.SaltSnapshot>> getEncryptedWr
EncryptedScope scope = new EncryptedScope(rootMetadatapath, siteId, isPublic);
EncryptedRotatingSaltProvider saltProvider = new EncryptedRotatingSaltProvider(taggableCloudStorage,
scope.resolve(new CloudPath(config.getString(Const.Config.SaltsMetadataPathProp))).toString(), cloudEncryptionKeyProvider );
return new EncyptedSaltStoreWriter(config, saltProvider, fileManager, taggableCloudStorage, versionGenerator, scope, cloudEncryptionKeyProvider, siteId);
return new EncryptedSaltStoreWriter(config, saltProvider, fileManager, taggableCloudStorage, versionGenerator, scope, cloudEncryptionKeyProvider, siteId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import java.util.Base64;
import java.util.Collection;

public class EncyptedSaltStoreWriter extends SaltStoreWriter implements StoreWriter {
public class EncryptedSaltStoreWriter extends SaltStoreWriter implements StoreWriter {
private StoreScope scope;
private RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider;
private Integer siteId;

private static final Logger LOGGER = LoggerFactory.getLogger(EncyptedSaltStoreWriter.class);
public EncyptedSaltStoreWriter(JsonObject config, RotatingSaltProvider provider, FileManager fileManager,
TaggableCloudStorage cloudStorage, VersionGenerator versionGenerator, StoreScope scope,
RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider, Integer siteId) {
private static final Logger LOGGER = LoggerFactory.getLogger(EncryptedSaltStoreWriter.class);
public EncryptedSaltStoreWriter(JsonObject config, RotatingSaltProvider provider, FileManager fileManager,
TaggableCloudStorage cloudStorage, VersionGenerator versionGenerator, StoreScope scope,
RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider, Integer siteId) {
super(config, provider, fileManager, cloudStorage, versionGenerator);
this.scope = scope;
this.cloudEncryptionKeyProvider = cloudEncryptionKeyProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.uid2.admin.store.writer;

import com.uid2.admin.store.FileManager;
import com.uid2.admin.store.writer.EncyptedSaltStoreWriter;
import com.uid2.admin.store.version.VersionGenerator;
import com.uid2.shared.cloud.CloudStorageException;
import com.uid2.shared.cloud.TaggableCloudStorage;
Expand Down Expand Up @@ -108,14 +107,14 @@ private void verifyFile(String filelocation, RotatingSaltProvider.SaltSnapshot s

@Test
public void testUploadNew() throws Exception {
RotatingSaltProvider.SaltSnapshot snapshot = makeSnapshot(Instant.now(), Instant.ofEpochMilli(Instant.now().toEpochMilli() + 10000), 100);
RotatingSaltProvider.SaltSnapshot snapshot = makeSnapshot(Instant.now(), Instant.ofEpochMilli(Instant.now().toEpochMilli() + 10000), 1000000);

when(rotatingSaltProvider.getMetadata()).thenThrow(new CloudStorageException("The specified key does not exist: AmazonS3Exception: test-core-bucket"));
when(rotatingSaltProvider.getSnapshots()).thenReturn(null);

when(taggableCloudStorage.list(anyString())).thenReturn(new ArrayList<>());

EncyptedSaltStoreWriter encryptedSaltStoreWriter = new EncyptedSaltStoreWriter(config, rotatingSaltProvider,
EncryptedSaltStoreWriter encryptedSaltStoreWriter = new EncryptedSaltStoreWriter(config, rotatingSaltProvider,
fileManager, taggableCloudStorage, versionGenerator, storeScope, rotatingCloudEncryptionKeyProvider, siteId);

encryptedSaltStoreWriter.upload(snapshot);
Expand Down

0 comments on commit 18b99bf

Please sign in to comment.