Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
3eee3c83
Commit
3eee3c83
authored
5 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
no-jira: not found unit test
parent
4d7248dc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/org/olat/restapi/SharedFolderTest.java
+63
-0
63 additions, 0 deletions
src/test/java/org/olat/restapi/SharedFolderTest.java
with
63 additions
and
0 deletions
src/test/java/org/olat/restapi/SharedFolderTest.java
+
63
−
0
View file @
3eee3c83
...
@@ -169,6 +169,69 @@ public class SharedFolderTest extends OlatJerseyTestCase {
...
@@ -169,6 +169,69 @@ public class SharedFolderTest extends OlatJerseyTestCase {
conn
.
shutdown
();
conn
.
shutdown
();
}
}
/**
* GET for directory but a little deeper.
*
* @throws IOException
* @throws URISyntaxException
*/
@Test
public
void
getFolders_deep
()
throws
IOException
,
URISyntaxException
{
RestConnection
conn
=
new
RestConnection
();
Assert
.
assertTrue
(
conn
.
login
(
"administrator"
,
"openolat"
));
Identity
owner
=
JunitTestHelper
.
createAndPersistIdentityAsRndUser
(
"shared-owner-"
);
Organisation
defOrganisation
=
organisationService
.
getDefaultOrganisation
();
RepositoryEntry
sharedFolder
=
new
SharedFolderHandler
().
createResource
(
owner
,
"Shared 5"
,
"Shared files"
,
null
,
defOrganisation
,
Locale
.
ENGLISH
);
VFSContainer
container
=
SharedFolderManager
.
getInstance
().
getNamedSharedFolder
(
sharedFolder
,
true
);
VFSContainer
firstContainer
=
container
.
createChildContainer
(
"First"
);
VFSContainer
secondContainer
=
firstContainer
.
createChildContainer
(
"Second"
);
VFSContainer
thirdContainer
=
secondContainer
.
createChildContainer
(
"Third"
);
copyFileInResourceFolder
(
thirdContainer
,
"portrait.jpg"
,
"2_"
);
URI
uri
=
UriBuilder
.
fromUri
(
getFolderURI
(
sharedFolder
)).
path
(
"files"
)
.
path
(
"First"
).
path
(
"Second"
).
build
();
HttpGet
method
=
conn
.
createGet
(
uri
,
MediaType
.
APPLICATION_JSON
,
true
);
HttpResponse
response
=
conn
.
execute
(
method
);
Assert
.
assertEquals
(
200
,
response
.
getStatusLine
().
getStatusCode
());
List
<
FileVO
>
links
=
parseFileArray
(
response
.
getEntity
());
Assert
.
assertNotNull
(
links
);
Assert
.
assertEquals
(
1
,
links
.
size
());
Assert
.
assertEquals
(
"Third"
,
links
.
get
(
0
).
getTitle
());
conn
.
shutdown
();
}
/**
* GET for directory but a little deeper.
*
* @throws IOException
* @throws URISyntaxException
*/
@Test
public
void
getFolders_notFound
()
throws
IOException
,
URISyntaxException
{
RestConnection
conn
=
new
RestConnection
();
Assert
.
assertTrue
(
conn
.
login
(
"administrator"
,
"openolat"
));
Identity
owner
=
JunitTestHelper
.
createAndPersistIdentityAsRndUser
(
"shared-owner-"
);
Organisation
defOrganisation
=
organisationService
.
getDefaultOrganisation
();
RepositoryEntry
sharedFolder
=
new
SharedFolderHandler
().
createResource
(
owner
,
"Shared 5"
,
"Shared files"
,
null
,
defOrganisation
,
Locale
.
ENGLISH
);
VFSContainer
container
=
SharedFolderManager
.
getInstance
().
getNamedSharedFolder
(
sharedFolder
,
true
);
VFSContainer
firstContainer
=
container
.
createChildContainer
(
"First"
);
VFSContainer
secondContainer
=
firstContainer
.
createChildContainer
(
"Second"
);
VFSContainer
thirdContainer
=
secondContainer
.
createChildContainer
(
"Third"
);
copyFileInResourceFolder
(
thirdContainer
,
"portrait.jpg"
,
"2_"
);
URI
uri
=
UriBuilder
.
fromUri
(
getFolderURI
(
sharedFolder
)).
path
(
"files"
)
.
path
(
"First"
).
path
(
"Second"
).
path
(
"Trois"
).
build
();
HttpGet
method
=
conn
.
createGet
(
uri
,
MediaType
.
APPLICATION_JSON
,
true
);
HttpResponse
response
=
conn
.
execute
(
method
);
Assert
.
assertEquals
(
404
,
response
.
getStatusLine
().
getStatusCode
());
conn
.
shutdown
();
}
/**
/**
* Owner of the shared folder want to put a file.
* Owner of the shared folder want to put a file.
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment