urn_perun_facility_attribute_def_def_homeMountPoints extends FacilityAttributesModuleAbstract implements FacilityAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; List<String> homeMountPoints = attribute.valueAsList(); for (String st : homeMountPoints) { Matcher match = pattern.matcher(st); if (!match.matches()) throw new WrongAttributeValueException(attribute, "Bad homeMountPoints attribute format " + st); } }  @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 public void testCheckAttributeSyntaxCorrect() throws Exception { System.out.println("testCheckAttributeSyntaxCorrect()"); ArrayList<String> homeMountPts= new ArrayList<>(); homeMountPts.add("/mnt/mymountpoint1"); homeMountPts.add("/mnt/mymountpoint2"); attribute.setValue(homeMountPts); classInstance.checkAttributeSyntax(session, new Facility(), attribute); }
@Test(expected=WrongAttributeValueException.class) public void testCheckAttributeSyntaxBadFormat() throws Exception { System.out.println("testCheckAttributeSyntaxBadFormat"); ArrayList<String> homeMountPts= new ArrayList<>(); homeMountPts.add("/mnt/mymountpoint/"); homeMountPts.add("/mnt/mymountpoin@@t2\n"); attribute.setValue(homeMountPts); classInstance.checkAttributeSyntax(session, new Facility(), attribute); }