Skip to content
Permalink
Browse files
Improve exception handling
  • Loading branch information
Kunal Shubham committed Mar 4, 2022
1 parent ce36f9a commit 0832fabc8b4cba03b7f95d2f35374fede636a4ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
@@ -15,7 +15,7 @@ protected SegmentNodeStorePersistence getDestPersistence() {
}

@Override
protected String getSrcPathOrUri() throws Exception {
protected String getSrcPathOrUri(){
return getAzurePersistencePathOrUriSas();
}

@@ -82,7 +82,7 @@ public abstract class SegmentCopyTestBase {

protected abstract SegmentNodeStorePersistence getDestPersistence() throws Exception;

protected abstract String getSrcPathOrUri() throws URISyntaxException, InvalidKeyException, StorageException, Exception;
protected abstract String getSrcPathOrUri();

protected abstract String getDestPathOrUri();

@@ -242,10 +242,17 @@ protected String getAzurePersistencePathOrUri() {
return uri.toString();
}

protected String getAzurePersistencePathOrUriSas() throws Exception {
protected String getAzurePersistencePathOrUriSas() {
StringBuilder uri = new StringBuilder("az:");
String sasToken = azurite.getContainer(AZURE_CONTAINER)
.generateSharedAccessSignature(policy(READ_WRITE), null);
String sasToken;

try {
sasToken = azurite.getContainer(AZURE_CONTAINER)
.generateSharedAccessSignature(policy(READ_WRITE), null);
} catch (StorageException | InvalidKeyException | URISyntaxException e) {
throw new RuntimeException("Error while accessing container ", e);
}

uri.append("http://127.0.0.1:");
uri.append(azurite.getMappedPort()).append("/");
uri.append(AZURE_CONTAINER).append("/");

0 comments on commit 0832fab

Please sign in to comment.