urn_perun_facility_attribute_def_def_shell_passwd_scp extends FacilityAttributesModuleAbstract implements FacilityAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws WrongAttributeValueException { String shell = attribute.valueAsString(); if(shell == null) return; Matcher matcher = pattern.matcher(shell); if(!matcher.matches()) throw new WrongAttributeValueException(attribute, "Wrong format. ^(/[-_.A-z0-9]+)+$ expected"); }  @Override void checkAttributeSyntax(PerunSessionImpl perunSession, Facility facility, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl perunSession, Facility facility, Attribute attribute); @Override Attribute fillAttribute(PerunSessionImpl session, Facility facility, AttributeDefinition attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testCheckAttributeSyntaxWithIncorrectValue() throws Exception { System.out.println("testCheckAttributeSyntaxWithIncorrectValue()"); attributeToCheck.setValue("bad_example"); classInstance.checkAttributeSyntax(session, facility, attributeToCheck); }
@Test public void testCheckAttributeSyntaxCorrect() throws Exception { System.out.println("testCheckAttributeSyntaxCorrect()"); attributeToCheck.setValue("/example"); classInstance.checkAttributeSyntax(session, facility, attributeToCheck); }