urn_perun_member_resource_attribute_def_virt_groupStatus extends MemberResourceVirtualAttributesModuleAbstract implements MemberResourceVirtualAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Resource resource, Attribute attribute) throws WrongAttributeValueException { String status = attribute.valueAsString(); if (status == null) return; if (!"VALID".equals(status) && !"EXPIRED".equals(status)) throw new WrongAttributeValueException("Group status of member can be only 'VALID' or 'EXPIRED', not '"+status+"'"); }  @Override void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Resource resource, Attribute attribute); @Override Attribute getAttributeValue(PerunSessionImpl sess, Member member, Resource resource, AttributeDefinition attributeDefinition); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testCheckAttributeSyntaxWithWrongValue() throws Exception { System.out.println("testCheckAttributeSyntaxWithWrongValue()"); attributeToCheck.setValue("wrong_value"); classInstance.checkAttributeSyntax(session, member, resource, attributeToCheck); }
@Test public void testCheckAttributeValueCorrectSyntax() throws Exception { System.out.println("testCheckAttributeValueCorrectSyntax()"); attributeToCheck.setValue("VALID"); classInstance.checkAttributeSyntax(session, member, resource, attributeToCheck); attributeToCheck.setValue("EXPIRED"); classInstance.checkAttributeSyntax(session, member, resource, attributeToCheck); }