/** * Test create class registration. * * @throws AViewException */ @Ignore public void testCreateClassRegistration() throws AViewException { ClassRegistration clr = new ClassRegistration(); User user = UserHelper.getUser(554l); Class aviewClass = ClassHelper.getClass(14l); clr.setIsModerator("N"); clr.setAviewClass(aviewClass); clr.setUser(user); clr.setEnable2DSharing("Y"); clr.setEnable3DSharing("Y"); clr.setEnableAudioVideo("Y"); clr.setEnableDesktopSharing("Y"); clr.setEnableDocumentSharing("Y"); clr.setEnableVideoSharing("Y"); clr.setNodeTypeId(NodeTypeHelper.getClassroomNodeType()); ClassRegistrationHelper.createClassRegistration(clr, 44l, StatusHelper.getActiveStatusId()); List<ClassRegistration> clrLst = ClassRegistrationHelper.searchForClassRegister( user.getUserName(), user.getFname(), user.getLname(), aviewClass.getClassId(), clr.getIsModerator(), aviewClass.getCourseId(), null); assertEquals("Did not create CreateClassRegistration", 128l, clrLst.size()); }
/** * Test delete class register. * * @throws AViewException */ @Ignore public void testDeleteClassRegister() throws AViewException { Long clrId = 2l; User user = UserHelper.getUser(594l); Class aviewClass = ClassHelper.getClass(58l); List<ClassRegistration> clrLst = ClassRegistrationHelper.searchForClassRegister( user.getUserName(), user.getFname(), user.getLname(), aviewClass.getClassId(), "Y", null, null); int i = 0; ClassRegistration clr = new ClassRegistration(); for (i = 0; i <= clrLst.size(); i++) { if (clrId.equals(clrLst.get(i).getClassRegisterId())) { clr = (ClassRegistration) (clrLst.get(i)); break; } } assertTrue( "User must be active first", (clr.getStatusId() == StatusHelper.getActiveStatusId())); UserHelper.deleteUser(clrId, 44l); List<ClassRegistration> updatedClrLst = ClassRegistrationHelper.searchForClassRegister( user.getUserName(), user.getFname(), user.getLname(), aviewClass.getClassId(), "Y", null, null); int j = 0; ClassRegistration updatedClr = new ClassRegistration(); for (j = 0; j <= updatedClrLst.size(); j++) { if (clrId.equals(clrLst.get(i).getClassRegisterId())) { updatedClr = (ClassRegistration) (updatedClrLst.get(i)); break; } } assertTrue( "User is not deleted", (updatedClr.getStatusId() == StatusHelper.getDeletedStatusId())); }
/** * Test update class registration. * * @throws AViewException */ @Ignore public void testUpdateClassRegistration() throws AViewException { Integer nodeTypeId = 2; Long clrId = 522l; User user = UserHelper.getUser(591l); Class aviewClass = ClassHelper.getClass(77l); List<ClassRegistration> clrLst = ClassRegistrationHelper.searchForClassRegister( user.getUserName(), user.getFname(), user.getLname(), aviewClass.getClassId(), "Y", null, null); int i = 0; ClassRegistration clr = null; for (i = 0; i <= clrLst.size(); i++) { if (clrId.equals(clrLst.get(i).getClassRegisterId())) { clr = (ClassRegistration) (clrLst.get(i)); break; } } clr.setNodeTypeId(nodeTypeId); ClassRegistrationHelper.updateClassRegistration(clr, 44l); List<ClassRegistration> updatedClrLst = ClassRegistrationHelper.searchForClassRegister( user.getUserName(), user.getFname(), user.getLname(), aviewClass.getClassId(), "Y", null, null); int j = 0; ClassRegistration updatedClr = null; for (j = 0; j <= updatedClrLst.size(); j++) { if (clrId.equals(clrLst.get(i).getClassRegisterId())) { updatedClr = (ClassRegistration) (updatedClrLst.get(i)); break; } } assertEquals( "Did not Update CreateClassRegistration", updatedClr.getNodeTypeId(), clr.getNodeTypeId()); }