Search in sources :

Example 1 with CourseEnvironmentMapper

use of org.olat.course.export.CourseEnvironmentMapper in project OpenOLAT by OpenOLAT.

the class KeyAndNameConverterTest method convertBusinessGroupKeyToKey.

@Test
public void convertBusinessGroupKeyToKey() {
    CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
    MockBusinessGroup newGroup = new MockBusinessGroup(567l, "Group 1");
    BusinessGroupReference bgRef = new BusinessGroupReference(newGroup, 345l, "Group 1");
    envMapper.getGroups().add(bgRef);
    String convertedExp = convertExpressionKeyToKey("inRightGroup(\"345\")", envMapper);
    Assert.assertEquals("inRightGroup(\"567\")", convertedExp);
}
Also used : BusinessGroupReference(org.olat.group.model.BusinessGroupReference) CourseEnvironmentMapper(org.olat.course.export.CourseEnvironmentMapper) Test(org.junit.Test)

Example 2 with CourseEnvironmentMapper

use of org.olat.course.export.CourseEnvironmentMapper in project OpenOLAT by OpenOLAT.

the class KeyAndNameConverterTest method convertAreaNameToKey.

@Test
public void convertAreaNameToKey() {
    CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
    BGArea newArea = new MockArea(567l, "Area 1");
    BGAreaReference areaRef = new BGAreaReference(newArea, 345l, "Area 1");
    envMapper.getAreas().add(areaRef);
    String convertedExp = convertExpressionNameToKey("inLearningArea(\"Area 1\")", envMapper);
    Assert.assertEquals("inLearningArea(\"567\")", convertedExp);
}
Also used : BGArea(org.olat.group.area.BGArea) BGAreaReference(org.olat.group.model.BGAreaReference) CourseEnvironmentMapper(org.olat.course.export.CourseEnvironmentMapper) Test(org.junit.Test)

Example 3 with CourseEnvironmentMapper

use of org.olat.course.export.CourseEnvironmentMapper in project OpenOLAT by OpenOLAT.

the class KeyAndNameConverterTest method convertGroupAndAreaKeyToKey_sameKey.

@Test
public void convertGroupAndAreaKeyToKey_sameKey() {
    CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
    BGArea newArea = new MockArea(567l, "Area 1");
    BGAreaReference areaRef = new BGAreaReference(newArea, 345l, "Area 1");
    envMapper.getAreas().add(areaRef);
    MockBusinessGroup newGroup = new MockBusinessGroup(568l, "Group 1");
    BusinessGroupReference bgRef = new BusinessGroupReference(newGroup, 345l, "Group 1");
    envMapper.getGroups().add(bgRef);
    String convertedExp = convertExpressionKeyToKey("inLearningArea(\"345\") & inRightGroup(\"345\")", envMapper);
    Assert.assertEquals("inLearningArea(\"567\") & inRightGroup(\"568\")", convertedExp);
}
Also used : BGArea(org.olat.group.area.BGArea) BusinessGroupReference(org.olat.group.model.BusinessGroupReference) BGAreaReference(org.olat.group.model.BGAreaReference) CourseEnvironmentMapper(org.olat.course.export.CourseEnvironmentMapper) Test(org.junit.Test)

Example 4 with CourseEnvironmentMapper

use of org.olat.course.export.CourseEnvironmentMapper in project OpenOLAT by OpenOLAT.

the class KeyAndNameConverterTest method convertGroupAndAreaNameToKey_sameName.

/**
 * Test with same name for area and group
 */
@Test
public void convertGroupAndAreaNameToKey_sameName() {
    CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
    BGArea newArea = new MockArea(567l, "Test 1");
    BGAreaReference areaRef = new BGAreaReference(newArea, 345l, "Test 1");
    envMapper.getAreas().add(areaRef);
    MockBusinessGroup newGroup = new MockBusinessGroup(568l, "Test 1");
    BusinessGroupReference bgRef = new BusinessGroupReference(newGroup, 346l, "Test 1");
    envMapper.getGroups().add(bgRef);
    String convertedExp = convertExpressionNameToKey("inLearningArea(\"Test 1\") & inLearningGroup(\"Test 1\")", envMapper);
    Assert.assertEquals("inLearningArea(\"567\") & inLearningGroup(\"568\")", convertedExp);
}
Also used : BGArea(org.olat.group.area.BGArea) BusinessGroupReference(org.olat.group.model.BusinessGroupReference) BGAreaReference(org.olat.group.model.BGAreaReference) CourseEnvironmentMapper(org.olat.course.export.CourseEnvironmentMapper) Test(org.junit.Test)

Example 5 with CourseEnvironmentMapper

use of org.olat.course.export.CourseEnvironmentMapper in project OpenOLAT by OpenOLAT.

the class KeyAndNameConverterTest method convertAreaKeyToKey.

@Test
public void convertAreaKeyToKey() {
    CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
    BGArea newArea = new MockArea(567l, "Area 1");
    BGAreaReference areaRef = new BGAreaReference(newArea, 345l, "Area 1");
    envMapper.getAreas().add(areaRef);
    String convertedExp = convertExpressionKeyToKey("inLearningArea(\"345\")", envMapper);
    Assert.assertEquals("inLearningArea(\"567\")", convertedExp);
}
Also used : BGArea(org.olat.group.area.BGArea) BGAreaReference(org.olat.group.model.BGAreaReference) CourseEnvironmentMapper(org.olat.course.export.CourseEnvironmentMapper) Test(org.junit.Test)

Aggregations

CourseEnvironmentMapper (org.olat.course.export.CourseEnvironmentMapper)32 Test (org.junit.Test)18 BGArea (org.olat.group.area.BGArea)16 BGAreaReference (org.olat.group.model.BGAreaReference)16 BusinessGroupReference (org.olat.group.model.BusinessGroupReference)16 File (java.io.File)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 ICourse (org.olat.course.ICourse)6 OLATResource (org.olat.resource.OLATResource)6 CourseGroupManager (org.olat.course.groupsandrights.CourseGroupManager)4 PersistingCourseGroupManager (org.olat.course.groupsandrights.PersistingCourseGroupManager)4 BusinessGroup (org.olat.group.BusinessGroup)4 RepositoryEntryImportExport (org.olat.repository.RepositoryEntryImportExport)4 XStream (com.thoughtworks.xstream.XStream)2 FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 Roles (org.olat.core.id.Roles)2 TreeVisitor (org.olat.core.util.tree.TreeVisitor)2 Visitor (org.olat.core.util.tree.Visitor)2 CorruptedCourseException (org.olat.course.CorruptedCourseException)2