urn_perun_group_attribute_def_def_groupStructureSynchronizationTimes extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi { @Override public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if (attribute.getValue() == null) return; try { Attribute foundAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME); if(foundAttribute.getValue() != null) { throw new WrongReferenceAttributeValueException(attribute, foundAttribute, group, null, group, null, "Attribute " + attribute.getName() + " cannot be set because attribute " + GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME + " is already set."); } } catch (AttributeNotExistsException exc) { throw new ConsistencyErrorException("Attribute " + GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME + " is supposed to exist", exc); } }  @Override void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute); @Override List<String> getDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongReferenceAttributeValueException.class) public void testMissingReqAttribute() throws Exception { System.out.println("testMissingReqAttribute()"); attributeToCheck.setValue(Collections.singleton("08:50")); syncInterval.setValue("true"); classInstance.checkAttributeSemantics(sess, group, attributeToCheck); }
@Test public void testCorrectSemantics() throws Exception { System.out.println("testCorrectSemantics()"); classInstance.checkAttributeSemantics(sess, group, attributeToCheck); }