Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
File
Commits
225892f4
Commit
225892f4
authored
Aug 19, 2020
by
Erik Leckner
Browse files
file-azure
parent
13e88f8f
Pipeline
#6131
passed with stage
in 5 minutes and 23 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
provider/file-azure/pom.xml
View file @
225892f4
...
...
@@ -146,5 +146,71 @@
<url>
https://community.opengroup.org/api/v4/projects/90/packages/maven
</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<classifier>
spring-boot
</classifier>
<mainClass>
org.opengroup.osdu.file.FileApplication
</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-shade-plugin
</artifactId>
<version>
${maven-shade-plugin.version}
</version>
<configuration>
<keepDependenciesWithProvidedScope>
true
</keepDependenciesWithProvidedScope>
<createDependencyReducedPom>
true
</createDependencyReducedPom>
<filters>
<filter>
<artifact>
*:*
</artifact>
<excludes>
<exclude>
META-INF/*.SF
</exclude>
<exclude>
META-INF/*.DSA
</exclude>
<exclude>
META-INF/*.RSA
</exclude>
</excludes>
</filter>
</filters>
</configuration>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
${spring-boot.version}
</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>
shade
</goal>
</goals>
<phase>
package
</phase>
<configuration>
<transformers>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.AppendingTransformer"
>
<resource>
META-INF/spring.handlers
</resource>
</transformer>
<transformer
implementation=
"org.springframework.boot.maven.PropertiesMergingResourceTransformer"
>
<resource>
META-INF/spring.factories
</resource>
</transformer>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.AppendingTransformer"
>
<resource>
META-INF/spring.schemas
</resource>
</transformer>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
/>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<mainClass>
org.opengroup.osdu.file.FileApplication
</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
provider/file-azure/src/main/java/org/opengroup/osdu/file/provider/azure/service/StorageServiceImpl.java
View file @
225892f4
...
...
@@ -90,7 +90,6 @@ public class StorageServiceImpl implements IStorageService {
.
format
(
instant
);
log
.
debug
(
"Created folderName {} for fileID {}"
,
folderName
,
filename
);
return
format
(
"%s/%s/%s"
,
userDesID
,
folderName
,
filename
);
//return format("%s/%s", folderName, filename);
}
}
provider/file-azure/src/test/java/org/opengroup/osdu/file/provider/azure/TestUtils.java
View file @
225892f4
...
...
@@ -33,13 +33,13 @@ public final class TestUtils {
public
static
final
String
AUTHORIZATION_TOKEN
=
"authToken"
;
public
static
final
String
PARTITION
=
"partition"
;
public
static
final
String
USER_DES_ID
=
"
common
-user"
;
public
static
final
String
CONTAINER_NAME
=
"o
des-os-file-temp
"
;
public
static
final
String
USER_DES_ID
=
"
osdu
-user"
;
public
static
final
String
CONTAINER_NAME
=
"o
sdu-container
"
;
public
static
final
String
STORAGE_NAME
=
"adotestfqofqosn0o4sa"
;
public
static
final
String
UUID_REGEX
=
"(.{8})(.{4})(.{4})(.{4})(.{12})"
;
public
static
final
Pattern
AZURE_OBJECT_URI
=
Pattern
.
compile
(
"^https://[\\w,\\s-]+/[\\w,\\s-]+/[\\w,\\s-]+"
);
=
Pattern
.
compile
(
"^https://[\\w,\\s-]+/[\\w,\\s-]+/[\\w,\\s-]+
/?.*$
"
);
public
static
final
Condition
<
String
>
UUID_CONDITION
=
new
Condition
<>(
TestUtils:
:
isValidUuid
,
"Valid UUID"
);
public
static
final
Condition
<
String
>
AZURE_URL_CONDITION
...
...
@@ -69,14 +69,14 @@ public final class TestUtils {
}
public
static
URI
getAzureObjectUri
(
String
containerName
,
String
folderName
,
String
filename
)
{
return
URI
.
create
(
format
(
"%s%s.blob.core.windows.net/%s/%s"
,
AZURE_PROTOCOL
,
STORAGE_NAME
,
containerName
,
filename
));
return
URI
.
create
(
format
(
"%s%s.blob.core.windows.net/%s/%s
/%s
"
,
AZURE_PROTOCOL
,
STORAGE_NAME
,
containerName
,
folderName
,
filename
));
}
@SneakyThrows
public
static
URL
getAzureObjectUrl
(
String
containerName
,
String
folderName
,
String
filename
)
{
return
new
URL
(
format
(
"%s%s.blob.core.windows.net/%s/%s?sv=2019-07-07&se=2020-08-08T13A36A49Z&skoid=0fa47244-83d8-4311-b05c-fefb49d8b0a9&sktid=58975fd3-4977-44d0-bea8-37af0baac100&skt=2020-08-08T013A3649Z&ske=2020-08-08T133649Z&sks=b&skv=2019-07-07&sr=b&sp=r&sig=Hh5xGUpvTkEDeArXaWmV6FnSOMbYLRdHSfGlOlsC7wD2020-08-07"
,
AZURE_PROTOCOL
,
STORAGE_NAME
,
containerName
,
filename
));
"%s%s.blob.core.windows.net/%s/%s
/%s
?sv=2019-07-07&se=2020-08-08T13A36A49Z&skoid=0fa47244-83d8-4311-b05c-fefb49d8b0a9&sktid=58975fd3-4977-44d0-bea8-37af0baac100&skt=2020-08-08T013A3649Z&ske=2020-08-08T133649Z&sks=b&skv=2019-07-07&sr=b&sp=r&sig=Hh5xGUpvTkEDeArXaWmV6FnSOMbYLRdHSfGlOlsC7wD2020-08-07"
,
AZURE_PROTOCOL
,
STORAGE_NAME
,
containerName
,
folderName
,
filename
));
}
public
static
Instant
now
()
{
...
...
provider/file-azure/src/test/java/org/opengroup/osdu/file/provider/azure/service/StorageServiceImplTest.java
View file @
225892f4
...
...
@@ -75,16 +75,18 @@ class StorageServiceImplTest {
SignedUrl
signedUrl
=
storageService
.
createSignedUrl
(
TestUtils
.
FILE_ID
,
TestUtils
.
AUTHORIZATION_TOKEN
,
TestUtils
.
PARTITION
);
System
.
out
.
println
(
"URL"
+
signedUrl
.
getUrl
().
toString
());
System
.
out
.
println
(
"URI"
+
signedUrl
.
getUri
().
toString
());
// then
//
then(signedUrl).satisfies(url -> {
//
then(url.getUrl().toString()).is(TestUtils.AZURE_URL_CONDITION);
//
then(url.getUri().toString()).matches(TestUtils.AZURE_OBJECT_URI);
//
then(url.getCreatedAt()).isBefore(now());
//
then(url.getCreatedBy()).isEqualTo(TestUtils.USER_DES_ID);
//
});
//
verify(storageRepository).createSignedObject(eq(TestUtils.CONTAINER_NAME), filenameCaptor.capture());
//
then(filenameCaptor.getValue()).matches(TestUtils.USER_DES_ID + ".*?" + TestUtils.UUID_REGEX);
then
(
signedUrl
).
satisfies
(
url
->
{
//
then(url.getUrl().toString()).is(TestUtils.AZURE_URL_CONDITION);
//
then(url.getUri().toString()).matches(TestUtils.AZURE_OBJECT_URI);
then
(
url
.
getCreatedAt
()).
isBefore
(
now
());
then
(
url
.
getCreatedBy
()).
isEqualTo
(
TestUtils
.
USER_DES_ID
);
});
verify
(
storageRepository
).
createSignedObject
(
eq
(
TestUtils
.
CONTAINER_NAME
),
filenameCaptor
.
capture
());
then
(
filenameCaptor
.
getValue
()).
matches
(
TestUtils
.
USER_DES_ID
+
".*?"
+
TestUtils
.
UUID_REGEX
);
}
@Test
...
...
@@ -97,11 +99,11 @@ class StorageServiceImplTest {
TestUtils
.
AUTHORIZATION_TOKEN
,
TestUtils
.
PARTITION
));
// then
/*
then(thrown)
then
(
thrown
)
.
isInstanceOf
(
BadRequestException
.
class
)
.
hasMessageContaining
(
"The maximum filepath length is 1024 characters"
);
verify
(
storageRepository
,
never
()).
createSignedObject
(
anyString
(),
anyString
());
*/
}
private
SignedObject
getSignedObject
()
{
...
...
provider/file-gcp-datastore/src/test/java/org/opengroup/osdu/file/provider/gcp/service/StorageServiceImplTest.java
View file @
225892f4
...
...
@@ -74,7 +74,7 @@ class StorageServiceImplTest {
// when
SignedUrl
signedUrl
=
storageService
.
createSignedUrl
(
TestUtils
.
FILE_ID
,
TestUtils
.
AUTHORIZATION_TOKEN
,
TestUtils
.
PARTITION
);
System
.
out
.
println
(
"URI"
+
signedUrl
.
getUri
().
toString
());
// then
then
(
signedUrl
).
satisfies
(
url
->
{
then
(
url
.
getUrl
().
toString
()).
is
(
TestUtils
.
GCS_URL_CONDITION
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment