Gitlab Community Edition Instance
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cdstar
cdstar
Commits
bb12e9d9
Commit
bb12e9d9
authored
Aug 09, 2021
by
mhellka
Browse files
Test unicode names in file upload
parent
d3a841e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
cdstar-rest/src/test/java/de/gwdg/cdstar/rest/v3/CrudFileTest.java
View file @
bb12e9d9
...
...
@@ -7,10 +7,6 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.Map
;
import
jakarta.ws.rs.client.Entity
;
import
jakarta.ws.rs.core.Form
;
import
jakarta.ws.rs.core.Response.Status
;
import
org.junit.Test
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
@@ -20,6 +16,9 @@ import de.gwdg.cdstar.rest.BaseRestTest;
import
de.gwdg.cdstar.runtime.client.CDStarFile
;
import
de.gwdg.cdstar.runtime.services.VaultRegistry
;
import
de.gwdg.cdstar.web.common.model.FileInfo
;
import
jakarta.ws.rs.client.Entity
;
import
jakarta.ws.rs.core.Form
;
import
jakarta.ws.rs.core.Response.Status
;
public
class
CrudFileTest
extends
BaseRestTest
{
...
...
@@ -88,6 +87,22 @@ public class CrudFileTest extends BaseRestTest {
assertEquals
(
2
,
getJsonLong
(
"file_count"
));
}
@Test
public
void
testUnicodeNames
()
{
var
id
=
makeArchive
();
var
name
=
"測試"
;
putFile
(
id
,
name
,
"Hello World"
,
"text/plain"
);
assertStatus
(
Status
.
CREATED
);
putFile
(
id
,
name
,
"Hello World 2"
,
"text/plain"
);
assertStatus
(
Status
.
OK
);
target
(
"/v3/test/"
,
id
,
"/"
,
name
).
request
().
get
();
assertStatus
(
Status
.
OK
);
target
(
"/v3/test/"
,
id
,
"/"
,
name
).
queryParam
(
"info"
,
"true"
).
request
().
get
();
assertStatus
(
Status
.
OK
);
assertEquals
(
"測試"
,
getJsonString
(
"name"
));
}
@Test
public
void
testPreventOverwrite
()
{
final
String
id
=
makeArchive
();
...
...
@@ -124,7 +139,7 @@ public class CrudFileTest extends BaseRestTest {
target
(
"/v3/test/"
,
id
,
"/test.txt"
).
queryParam
(
"info"
,
""
).
request
().
get
();
assertStatus
(
Status
.
OK
);
assertEquals
(
new
HashSet
<>(
Arrays
.
asList
(
"md5"
,
"sha1"
,
"sha256"
)),
new
HashSet
<>(
getJsonKeys
(
"digests"
)));
new
HashSet
<>(
getJsonKeys
(
"digests"
)));
// Re-create file with only SHA256 enabled
putFile
(
id
,
"test.txt"
,
"bar"
,
"plain/text"
);
...
...
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