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
51f16d60
Commit
51f16d60
authored
10 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-1063: fix doInSync exception
parent
b0aa378a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/olat/restapi/repository/course/CoursesWebService.java
+3
-17
3 additions, 17 deletions
...org/olat/restapi/repository/course/CoursesWebService.java
src/test/java/org/olat/restapi/CourseGroupMgmtTest.java
+10
-13
10 additions, 13 deletions
src/test/java/org/olat/restapi/CourseGroupMgmtTest.java
with
13 additions
and
30 deletions
src/main/java/org/olat/restapi/repository/course/CoursesWebService.java
+
3
−
17
View file @
51f16d60
...
@@ -54,7 +54,6 @@ import org.olat.core.CoreSpringFactory;
...
@@ -54,7 +54,6 @@ import org.olat.core.CoreSpringFactory;
import
org.olat.core.commons.persistence.DBFactory
;
import
org.olat.core.commons.persistence.DBFactory
;
import
org.olat.core.gui.UserRequest
;
import
org.olat.core.gui.UserRequest
;
import
org.olat.core.gui.control.Controller
;
import
org.olat.core.gui.control.Controller
;
import
org.olat.core.helpers.Settings
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.OLATResourceable
;
import
org.olat.core.id.OLATResourceable
;
import
org.olat.core.id.Roles
;
import
org.olat.core.id.Roles
;
...
@@ -199,13 +198,10 @@ public class CoursesWebService {
...
@@ -199,13 +198,10 @@ public class CoursesWebService {
@Path
(
"{courseId}"
)
@Path
(
"{courseId}"
)
public
CourseWebService
getCourse
(
@PathParam
(
"courseId"
)
Long
courseId
)
{
public
CourseWebService
getCourse
(
@PathParam
(
"courseId"
)
Long
courseId
)
{
OLATResource
ores
=
getCourseOLATResource
(
courseId
);
ICourse
course
=
loadCourse
(
courseId
);
if
(
ores
==
null
)
return
null
;
ICourse
course
=
CourseFactory
.
loadCourse
(
courseId
);
if
(
course
==
null
)
return
null
;
if
(
course
==
null
)
return
null
;
CourseWebService
courseWs
=
new
CourseWebService
(
ores
,
course
);
OLATResource
ores
=
course
.
getCourseEnvironment
().
getCourseGroupManager
().
getCourseResource
();
return
new
CourseWebService
(
ores
,
course
);
return
courseWs
;
}
}
/**
/**
...
@@ -330,16 +326,6 @@ public class CoursesWebService {
...
@@ -330,16 +326,6 @@ public class CoursesWebService {
return
Response
.
ok
(
vo
).
build
();
return
Response
.
ok
(
vo
).
build
();
}
}
private
OLATResource
getCourseOLATResource
(
Long
courseId
)
{
String
typeName
=
OresHelper
.
calculateTypeName
(
CourseModule
.
class
);
OLATResource
ores
=
OLATResourceManager
.
getInstance
().
findResourceable
(
courseId
,
typeName
);
if
(
ores
==
null
&&
Settings
.
isJUnitTest
())
{
//hack for the BGContextManagerImpl which load the course
ores
=
OLATResourceManager
.
getInstance
().
findResourceable
(
courseId
,
"junitcourse"
);
}
return
ores
;
}
public
static
boolean
isCourseAccessible
(
ICourse
course
,
boolean
authorRightsMandatory
,
HttpServletRequest
request
)
{
public
static
boolean
isCourseAccessible
(
ICourse
course
,
boolean
authorRightsMandatory
,
HttpServletRequest
request
)
{
if
(
authorRightsMandatory
&&
!
isAuthor
(
request
))
{
if
(
authorRightsMandatory
&&
!
isAuthor
(
request
))
{
return
false
;
return
false
;
...
...
This diff is collapsed.
Click to expand it.
src/test/java/org/olat/restapi/CourseGroupMgmtTest.java
+
10
−
13
View file @
51f16d60
...
@@ -56,15 +56,14 @@ import org.junit.Test;
...
@@ -56,15 +56,14 @@ import org.junit.Test;
import
org.olat.basesecurity.BaseSecurity
;
import
org.olat.basesecurity.BaseSecurity
;
import
org.olat.core.commons.persistence.DB
;
import
org.olat.core.commons.persistence.DB
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.OLATResourceable
;
import
org.olat.core.logging.OLog
;
import
org.olat.core.logging.OLog
;
import
org.olat.core.logging.Tracing
;
import
org.olat.core.logging.Tracing
;
import
org.olat.co
re.util.resource.OresHelper
;
import
org.olat.co
urse.ICourse
;
import
org.olat.group.BusinessGroup
;
import
org.olat.group.BusinessGroup
;
import
org.olat.group.BusinessGroupService
;
import
org.olat.group.BusinessGroupService
;
import
org.olat.repository.RepositoryEntry
;
import
org.olat.repository.RepositoryEntry
;
import
org.olat.re
source.OLATResource
;
import
org.olat.re
pository.RepositoryManager
;
import
org.olat.res
ource.OLATResourceManager
;
import
org.olat.res
tapi.repository.course.CoursesWebService
;
import
org.olat.restapi.support.vo.GroupVO
;
import
org.olat.restapi.support.vo.GroupVO
;
import
org.olat.test.JunitTestHelper
;
import
org.olat.test.JunitTestHelper
;
import
org.olat.test.OlatJerseyTestCase
;
import
org.olat.test.OlatJerseyTestCase
;
...
@@ -92,11 +91,13 @@ public class CourseGroupMgmtTest extends OlatJerseyTestCase {
...
@@ -92,11 +91,13 @@ public class CourseGroupMgmtTest extends OlatJerseyTestCase {
private
RestConnection
conn
;
private
RestConnection
conn
;
@Autowired
@Autowired
DB
dbInstance
;
private
DB
dbInstance
;
@Autowired
@Autowired
private
BusinessGroupService
businessGroupService
;
private
BusinessGroupService
businessGroupService
;
@Autowired
@Autowired
private
BaseSecurity
securityManager
;
private
BaseSecurity
securityManager
;
@Autowired
private
RepositoryManager
repositoryManager
;
/**
/**
...
@@ -113,15 +114,11 @@ public class CourseGroupMgmtTest extends OlatJerseyTestCase {
...
@@ -113,15 +114,11 @@ public class CourseGroupMgmtTest extends OlatJerseyTestCase {
id1
=
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-c-g-1"
);
id1
=
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-c-g-1"
);
id2
=
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-c-g-2"
);
id2
=
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-c-g-2"
);
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-c-g-3"
);
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-c-g-3"
);
Identity
auth
=
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-course-grp-one"
);
OLATResourceManager
rm
=
OLATResourceManager
.
getInstance
();
ICourse
course
=
CoursesWebService
.
createEmptyCourse
(
auth
,
"course for groups"
,
"course with groups for REST API testing"
,
null
);
// create course and persist as OLATResourceImpl
OLATResourceable
resourceable
=
OresHelper
.
createOLATResourceableInstance
(
"junitcourse"
,
System
.
currentTimeMillis
());
OLATResource
r
=
rm
.
createOLATResourceInstance
(
resourceable
);
rm
.
saveOLATResource
(
r
);
courseRepoEntry
=
JunitTestHelper
.
createAndPersistRepositoryEntry
(
r
,
false
);
dbInstance
.
saveObject
(
courseRepoEntry
);
dbInstance
.
commitAndCloseSession
();
dbInstance
.
commitAndCloseSession
();
courseRepoEntry
=
repositoryManager
.
lookupRepositoryEntry
(
course
,
true
);
// create groups without waiting list
// create groups without waiting list
g1
=
businessGroupService
.
createBusinessGroup
(
null
,
"rest-g1"
,
null
,
0
,
10
,
false
,
false
,
courseRepoEntry
);
g1
=
businessGroupService
.
createBusinessGroup
(
null
,
"rest-g1"
,
null
,
0
,
10
,
false
,
false
,
courseRepoEntry
);
...
...
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