Skip to content
Snippets Groups Projects
Commit 24e9e5cf authored by srosse's avatar srosse
Browse files

OO-1393: enhance course config with chat, efficiencyStatement, css, glossary...

parent 7b9ab6c0
No related branches found
No related tags found
No related merge requests found
...@@ -547,6 +547,22 @@ public class CoursesWebService { ...@@ -547,6 +547,22 @@ public class CoursesWebService {
if(StringHelper.containsNonWhitespace(courseConfigVO.getSharedFolderSoftKey())) { if(StringHelper.containsNonWhitespace(courseConfigVO.getSharedFolderSoftKey())) {
courseConfig.setSharedFolderSoftkey(courseConfigVO.getSharedFolderSoftKey()); courseConfig.setSharedFolderSoftkey(courseConfigVO.getSharedFolderSoftKey());
} }
if(courseConfigVO.getCalendar() != null) {
courseConfig.setCalendarEnabled(courseConfigVO.getCalendar().booleanValue());
}
if(courseConfigVO.getChat() != null) {
courseConfig.setChatIsEnabled(courseConfigVO.getChat().booleanValue());
}
if(courseConfigVO.getEfficencyStatement() != null) {
courseConfig.setEfficencyStatementIsEnabled(courseConfigVO.getEfficencyStatement().booleanValue());
}
if(StringHelper.containsNonWhitespace(courseConfigVO.getCssLayoutRef())) {
courseConfig.setCssLayoutRef(courseConfigVO.getCssLayoutRef());
}
if(StringHelper.containsNonWhitespace(courseConfigVO.getGlossarySoftkey())) {
courseConfig.setGlossarySoftKey(courseConfigVO.getGlossarySoftkey());
}
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
} }
CourseFactory.saveCourse(course.getResourceableId()); CourseFactory.saveCourse(course.getResourceableId());
......
...@@ -201,6 +201,11 @@ public class ObjectFactory { ...@@ -201,6 +201,11 @@ public class ObjectFactory {
public static CourseConfigVO getConfig(ICourse course) { public static CourseConfigVO getConfig(ICourse course) {
CourseConfigVO vo = new CourseConfigVO(); CourseConfigVO vo = new CourseConfigVO();
CourseConfig config = course.getCourseEnvironment().getCourseConfig(); CourseConfig config = course.getCourseEnvironment().getCourseConfig();
vo.setCalendar(new Boolean(config.isCalendarEnabled()));
vo.setChat(new Boolean(config.isChatEnabled()));
vo.setCssLayoutRef(config.getCssLayoutRef());
vo.setEfficencyStatement(new Boolean(config.isEfficencyStatementEnabled()));
vo.setGlossarySoftkey(config.getGlossarySoftKey());
vo.setSharedFolderSoftKey(config.getSharedFolderSoftkey()); vo.setSharedFolderSoftKey(config.getSharedFolderSoftkey());
return vo; return vo;
} }
......
...@@ -36,12 +36,57 @@ import javax.xml.bind.annotation.XmlRootElement; ...@@ -36,12 +36,57 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "courseVO") @XmlRootElement(name = "courseVO")
public class CourseConfigVO { public class CourseConfigVO {
private Boolean calendar;
private Boolean chat;
private String cssLayoutRef;
private Boolean efficencyStatement;
private String glossarySoftkey;
private String sharedFolderSoftKey; private String sharedFolderSoftKey;
public CourseConfigVO() { public CourseConfigVO() {
//make JAXB happy //make JAXB happy
} }
public Boolean getCalendar() {
return calendar;
}
public void setCalendar(Boolean calendar) {
this.calendar = calendar;
}
public Boolean getChat() {
return chat;
}
public void setChat(Boolean chat) {
this.chat = chat;
}
public String getCssLayoutRef() {
return cssLayoutRef;
}
public void setCssLayoutRef(String cssLayoutRef) {
this.cssLayoutRef = cssLayoutRef;
}
public Boolean getEfficencyStatement() {
return efficencyStatement;
}
public void setEfficencyStatement(Boolean efficencyStatement) {
this.efficencyStatement = efficencyStatement;
}
public String getGlossarySoftkey() {
return glossarySoftkey;
}
public void setGlossarySoftkey(String glossarySoftkey) {
this.glossarySoftkey = glossarySoftkey;
}
public String getSharedFolderSoftKey() { public String getSharedFolderSoftKey() {
return sharedFolderSoftKey; return sharedFolderSoftKey;
} }
......
...@@ -100,16 +100,13 @@ public class CalendarTest extends OlatJerseyTestCase { ...@@ -100,16 +100,13 @@ public class CalendarTest extends OlatJerseyTestCase {
if(course1 == null) { if(course1 == null) {
//create a course with a calendar //create a course with a calendar
CourseConfigVO config = new CourseConfigVO(); CourseConfigVO config = new CourseConfigVO();
config.setCalendar(Boolean.TRUE);
course1 = CoursesWebService.createEmptyCourse(id1, "Cal course", "Cal course", config); course1 = CoursesWebService.createEmptyCourse(id1, "Cal course", "Cal course", config);
dbInstance.commit(); dbInstance.commit();
ICourse course = CourseFactory.openCourseEditSession(course1.getResourceableId());
ICourse course = CourseFactory.loadCourse(course1.getResourceableId());
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig(); CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
courseConfig.setCalendarEnabled(true); Assert.assertTrue(courseConfig.isCalendarEnabled());
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
dbInstance.commit();
CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager(); CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager();
KalendarRenderWrapper calendarWrapper = calendarManager.getCourseCalendar(course); KalendarRenderWrapper calendarWrapper = calendarManager.getCourseCalendar(course);
...@@ -142,22 +139,16 @@ public class CalendarTest extends OlatJerseyTestCase { ...@@ -142,22 +139,16 @@ public class CalendarTest extends OlatJerseyTestCase {
if(course2 == null) { if(course2 == null) {
//create a course with a calendar //create a course with a calendar
CourseConfigVO config = new CourseConfigVO(); CourseConfigVO config = new CourseConfigVO();
config.setCalendar(Boolean.TRUE);
course2 = CoursesWebService.createEmptyCourse(id2, "Cal course - 2", "Cal course - 2", config); course2 = CoursesWebService.createEmptyCourse(id2, "Cal course - 2", "Cal course - 2", config);
dbInstance.commit(); dbInstance.commit();
ICourse course = CourseFactory.openCourseEditSession(course2.getResourceableId());
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
courseConfig.setCalendarEnabled(true);
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager(); CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager();
KalendarRenderWrapper calendarWrapper = calendarManager.getCourseCalendar(course2); KalendarRenderWrapper calendarWrapper = calendarManager.getCourseCalendar(course2);
Assert.assertNotNull(calendarWrapper); Assert.assertNotNull(calendarWrapper);
RepositoryEntry entry = repositoryManager.lookupRepositoryEntry(course2, false); RepositoryEntry entry = repositoryManager.lookupRepositoryEntry(course2, false);
entry = repositoryManager.setAccess(entry, RepositoryEntry.ACC_USERS, false); entry = repositoryManager.setAccess(entry, RepositoryEntry.ACC_USERS, false);
dbInstance.commit(); dbInstance.commit();
} }
} }
......
...@@ -65,8 +65,8 @@ import org.olat.core.logging.OLog; ...@@ -65,8 +65,8 @@ import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.course.CourseFactory; import org.olat.course.CourseFactory;
import org.olat.course.ICourse; import org.olat.course.ICourse;
import org.olat.course.config.CourseConfig;
import org.olat.restapi.repository.course.CoursesWebService; import org.olat.restapi.repository.course.CoursesWebService;
import org.olat.restapi.support.vo.CourseConfigVO;
import org.olat.test.JunitTestHelper; import org.olat.test.JunitTestHelper;
import org.olat.test.OlatJerseyTestCase; import org.olat.test.OlatJerseyTestCase;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -96,17 +96,14 @@ public class CourseCalendarTest extends OlatJerseyTestCase { ...@@ -96,17 +96,14 @@ public class CourseCalendarTest extends OlatJerseyTestCase {
try { try {
// create course and persist as OLATResourceImpl // create course and persist as OLATResourceImpl
auth1 = JunitTestHelper.createAndPersistIdentityAsUser("rest-course-cal-one"); auth1 = JunitTestHelper.createAndPersistIdentityAsUser("rest-course-cal-one");
course1 = CoursesWebService.createEmptyCourse(auth1, "course calendar", "course with calendar for REST API testing", null); CourseConfigVO config = new CourseConfigVO();
config.setCalendar(Boolean.TRUE);
dbInstance.commit(); course1 = CoursesWebService.createEmptyCourse(auth1, "course calendar", "course with calendar for REST API testing", config);
ICourse course = CourseFactory.openCourseEditSession(course1.getResourceableId());
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
courseConfig.setCalendarEnabled(true);
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
dbInstance.commit(); dbInstance.commit();
ICourse course = CourseFactory.loadCourse(course1.getResourceableId());
Assert.assertTrue(course.getCourseConfig().isCalendarEnabled());
CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager(); CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager();
KalendarRenderWrapper calendarWrapper = calendarManager.getCourseCalendar(course); KalendarRenderWrapper calendarWrapper = calendarManager.getCourseCalendar(course);
......
...@@ -43,8 +43,6 @@ import java.util.List; ...@@ -43,8 +43,6 @@ import java.util.List;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilder;
import junit.framework.Assert;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
...@@ -53,15 +51,15 @@ import org.apache.http.util.EntityUtils; ...@@ -53,15 +51,15 @@ import org.apache.http.util.EntityUtils;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference; import org.codehaus.jackson.type.TypeReference;
import org.junit.After; import org.junit.After;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.olat.admin.securitygroup.gui.IdentitiesAddEvent; import org.olat.admin.securitygroup.gui.IdentitiesAddEvent;
import org.olat.basesecurity.BaseSecurity;
import org.olat.basesecurity.BaseSecurityManager; import org.olat.basesecurity.BaseSecurityManager;
import org.olat.basesecurity.Constants; import org.olat.basesecurity.Constants;
import org.olat.basesecurity.GroupRoles; import org.olat.basesecurity.GroupRoles;
import org.olat.basesecurity.SecurityGroup; import org.olat.basesecurity.SecurityGroup;
import org.olat.core.CoreSpringFactory; import org.olat.core.commons.persistence.DB;
import org.olat.core.commons.persistence.DBFactory; import org.olat.core.commons.persistence.DBFactory;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.Roles; import org.olat.core.id.Roles;
...@@ -74,6 +72,7 @@ import org.olat.repository.RepositoryManager; ...@@ -74,6 +72,7 @@ import org.olat.repository.RepositoryManager;
import org.olat.repository.RepositoryService; import org.olat.repository.RepositoryService;
import org.olat.repository.model.SearchRepositoryEntryParameters; import org.olat.repository.model.SearchRepositoryEntryParameters;
import org.olat.restapi.repository.course.CoursesWebService; import org.olat.restapi.repository.course.CoursesWebService;
import org.olat.restapi.support.vo.CourseConfigVO;
import org.olat.restapi.support.vo.CourseVO; import org.olat.restapi.support.vo.CourseVO;
import org.olat.restapi.support.vo.RepositoryEntryVO; import org.olat.restapi.support.vo.RepositoryEntryVO;
import org.olat.test.JunitTestHelper; import org.olat.test.JunitTestHelper;
...@@ -89,10 +88,14 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -89,10 +88,14 @@ public class CourseTest extends OlatJerseyTestCase {
private ICourse course1; private ICourse course1;
private RestConnection conn; private RestConnection conn;
@Autowired
private DB dbInstance;
@Autowired @Autowired
private RepositoryManager repositoryManager; private RepositoryManager repositoryManager;
@Autowired @Autowired
private RepositoryService repositoryService; private RepositoryService repositoryService;
@Autowired
private BaseSecurityManager securityManager;
/** /**
* SetUp is called before each test. * SetUp is called before each test.
...@@ -142,9 +145,25 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -142,9 +145,25 @@ public class CourseTest extends OlatJerseyTestCase {
assertEquals(course1.getCourseTitle(), course.getTitle()); assertEquals(course1.getCourseTitle(), course.getTitle());
} }
@Test
public void testGetCourseConfig() throws IOException, URISyntaxException {
assertTrue("Cannot login as administrator", conn.login("administrator", "openolat"));
URI uri = conn.getContextURI().path("repo").path("courses").path(course1.getResourceableId().toString()).path("configuration").build();
HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON, true);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
CourseConfigVO courseConfig = conn.parse(response, CourseConfigVO.class);
Assert.assertNotNull(courseConfig);
Assert.assertNotNull(courseConfig.getCssLayoutRef());
Assert.assertNotNull(courseConfig.getCalendar());
Assert.assertNotNull(courseConfig.getChat());
Assert.assertNotNull(courseConfig.getEfficencyStatement());
}
@Test @Test
public void testGetCourse_keyRoundTrip() throws IOException, URISyntaxException { public void testGetCourse_keyRoundTrip() throws IOException, URISyntaxException {
RepositoryEntry courseRe = RepositoryManager.getInstance().lookupRepositoryEntry(course1, false); RepositoryEntry courseRe = repositoryManager.lookupRepositoryEntry(course1, false);
Assert.assertNotNull(courseRe); Assert.assertNotNull(courseRe);
assertTrue("Cannot login as administrator", conn.login("administrator", "openolat")); assertTrue("Cannot login as administrator", conn.login("administrator", "openolat"));
...@@ -201,7 +220,7 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -201,7 +220,7 @@ public class CourseTest extends OlatJerseyTestCase {
@Test @Test
public void testDeleteCourses() throws IOException, URISyntaxException { public void testDeleteCourses() throws IOException, URISyntaxException {
ICourse course = CoursesWebService.createEmptyCourse(admin, "courseToDel", "course to delete", null); ICourse course = CoursesWebService.createEmptyCourse(admin, "courseToDel", "course to delete", null);
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
assertTrue(conn.login("administrator", "openolat")); assertTrue(conn.login("administrator", "openolat"));
...@@ -233,25 +252,21 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -233,25 +252,21 @@ public class CourseTest extends OlatJerseyTestCase {
EntityUtils.consume(response.getEntity()); EntityUtils.consume(response.getEntity());
//is auth0 author //is auth0 author
BaseSecurity securityManager = BaseSecurityManager.getInstance();
SecurityGroup authorGroup = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS); SecurityGroup authorGroup = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS);
boolean isAuthor = securityManager.isIdentityInSecurityGroup(auth0, authorGroup); boolean isAuthor = securityManager.isIdentityInSecurityGroup(auth0, authorGroup);
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
assertTrue(isAuthor); assertTrue(isAuthor);
//is auth0 owner //is auth0 owner
RepositoryManager rm = RepositoryManager.getInstance(); RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(course1, true);
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
RepositoryEntry repositoryEntry = rm.lookupRepositoryEntry(course1, true);
boolean isOwner = repositoryService.hasRole(auth0, repositoryEntry, GroupRoles.owner.name()); boolean isOwner = repositoryService.hasRole(auth0, repositoryEntry, GroupRoles.owner.name());
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
assertTrue(isOwner); assertTrue(isOwner);
} }
@Test @Test
public void testGetAuthors() throws IOException, URISyntaxException { public void testGetAuthors() throws IOException, URISyntaxException {
//make auth1 and auth2 authors //make auth1 and auth2 authors
BaseSecurity securityManager = BaseSecurityManager.getInstance();
SecurityGroup authorGroup = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS); SecurityGroup authorGroup = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS);
if(!securityManager.isIdentityInSecurityGroup(auth1, authorGroup)) { if(!securityManager.isIdentityInSecurityGroup(auth1, authorGroup)) {
securityManager.addIdentityToSecurityGroup(auth1, authorGroup); securityManager.addIdentityToSecurityGroup(auth1, authorGroup);
...@@ -259,17 +274,16 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -259,17 +274,16 @@ public class CourseTest extends OlatJerseyTestCase {
if(!securityManager.isIdentityInSecurityGroup(auth2, authorGroup)) { if(!securityManager.isIdentityInSecurityGroup(auth2, authorGroup)) {
securityManager.addIdentityToSecurityGroup(auth2, authorGroup); securityManager.addIdentityToSecurityGroup(auth2, authorGroup);
} }
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
//make auth1 and auth2 owner //make auth1 and auth2 owner
RepositoryManager rm = RepositoryManager.getInstance(); RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(course1, true);
RepositoryEntry repositoryEntry = rm.lookupRepositoryEntry(course1, true);
List<Identity> authors = new ArrayList<Identity>(); List<Identity> authors = new ArrayList<Identity>();
authors.add(auth1); authors.add(auth1);
authors.add(auth2); authors.add(auth2);
IdentitiesAddEvent identitiesAddedEvent = new IdentitiesAddEvent(authors); IdentitiesAddEvent identitiesAddedEvent = new IdentitiesAddEvent(authors);
rm.addOwners(admin, identitiesAddedEvent, repositoryEntry); repositoryManager.addOwners(admin, identitiesAddedEvent, repositoryEntry);
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
//get them //get them
assertTrue(conn.login("administrator", "openolat")); assertTrue(conn.login("administrator", "openolat"));
...@@ -287,7 +301,6 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -287,7 +301,6 @@ public class CourseTest extends OlatJerseyTestCase {
@Test @Test
public void testRemoveAuthor() throws IOException, URISyntaxException { public void testRemoveAuthor() throws IOException, URISyntaxException {
//make auth1 and auth2 authors //make auth1 and auth2 authors
BaseSecurity securityManager = BaseSecurityManager.getInstance();
SecurityGroup authorGroup = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS); SecurityGroup authorGroup = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS);
if(!securityManager.isIdentityInSecurityGroup(auth1, authorGroup)) { if(!securityManager.isIdentityInSecurityGroup(auth1, authorGroup)) {
securityManager.addIdentityToSecurityGroup(auth1, authorGroup); securityManager.addIdentityToSecurityGroup(auth1, authorGroup);
...@@ -295,17 +308,16 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -295,17 +308,16 @@ public class CourseTest extends OlatJerseyTestCase {
if(!securityManager.isIdentityInSecurityGroup(auth2, authorGroup)) { if(!securityManager.isIdentityInSecurityGroup(auth2, authorGroup)) {
securityManager.addIdentityToSecurityGroup(auth2, authorGroup); securityManager.addIdentityToSecurityGroup(auth2, authorGroup);
} }
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
//make auth1 and auth2 owner //make auth1 and auth2 owner
RepositoryManager rm = RepositoryManager.getInstance(); RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(course1, true);
RepositoryEntry repositoryEntry = rm.lookupRepositoryEntry(course1, true);
List<Identity> authors = new ArrayList<Identity>(); List<Identity> authors = new ArrayList<Identity>();
authors.add(auth1); authors.add(auth1);
authors.add(auth2); authors.add(auth2);
IdentitiesAddEvent identitiesAddedEvent = new IdentitiesAddEvent(authors); IdentitiesAddEvent identitiesAddedEvent = new IdentitiesAddEvent(authors);
rm.addOwners(admin, identitiesAddedEvent, repositoryEntry); repositoryManager.addOwners(admin, identitiesAddedEvent, repositoryEntry);
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
//end setup //end setup
//test //test
...@@ -323,10 +335,10 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -323,10 +335,10 @@ public class CourseTest extends OlatJerseyTestCase {
EntityUtils.consume(response2.getEntity()); EntityUtils.consume(response2.getEntity());
//control //control
repositoryEntry = rm.lookupRepositoryEntry(course1, true); repositoryEntry = repositoryManager.lookupRepositoryEntry(course1, true);
assertFalse(repositoryService.hasRole(auth1, repositoryEntry, GroupRoles.owner.name())); assertFalse(repositoryService.hasRole(auth1, repositoryEntry, GroupRoles.owner.name()));
assertFalse(repositoryService.hasRole(auth2, repositoryEntry, GroupRoles.owner.name())); assertFalse(repositoryService.hasRole(auth2, repositoryEntry, GroupRoles.owner.name()));
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
} }
@Test @Test
...@@ -339,10 +351,9 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -339,10 +351,9 @@ public class CourseTest extends OlatJerseyTestCase {
EntityUtils.consume(response.getEntity()); EntityUtils.consume(response.getEntity());
//is auth0 coach/tutor //is auth0 coach/tutor
RepositoryManager rm = RepositoryManager.getInstance(); RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(course1, true);
RepositoryEntry repositoryEntry = rm.lookupRepositoryEntry(course1, true);
boolean isTutor = repositoryService.hasRole(auth1, repositoryEntry, GroupRoles.coach.name()); boolean isTutor = repositoryService.hasRole(auth1, repositoryEntry, GroupRoles.coach.name());
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
assertTrue(isTutor); assertTrue(isTutor);
} }
...@@ -356,10 +367,9 @@ public class CourseTest extends OlatJerseyTestCase { ...@@ -356,10 +367,9 @@ public class CourseTest extends OlatJerseyTestCase {
EntityUtils.consume(response.getEntity()); EntityUtils.consume(response.getEntity());
//is auth2 participant //is auth2 participant
RepositoryManager rm = RepositoryManager.getInstance(); RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(course1, true);
RepositoryEntry repositoryEntry = rm.lookupRepositoryEntry(course1, true);
boolean isParticipant = repositoryService.hasRole(auth2, repositoryEntry, GroupRoles.participant.name()); boolean isParticipant = repositoryService.hasRole(auth2, repositoryEntry, GroupRoles.participant.name());
DBFactory.getInstance().intermediateCommit(); dbInstance.intermediateCommit();
assertTrue(isParticipant); assertTrue(isParticipant);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment