urn_perun_resource_attribute_def_def_replicaDestinationPath extends ResourceAttributesModuleAbstract implements ResourceAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; Matcher match = pattern.matcher(attribute.valueAsString()); if (!match.matches()) { throw new WrongAttributeValueException(attribute, resource, "Bad replicaDestinationPath attribute format " + attribute.getValue()); } }  @Override void checkAttributeSyntax(PerunSessionImpl perunSession, Resource resource, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl perunSession, Resource resource, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testSyntaxWithWrongValue() throws Exception { System.out.println("testSyntaxWithWrongValue()"); attributeToCheck.setValue("bad_example"); classInstance.checkAttributeSyntax(sess, resource, attributeToCheck); }
@Test public void testSyntaxCorrect() throws Exception { System.out.println("testSyntaxCorrect()"); attributeToCheck.setValue("/example"); classInstance.checkAttributeSyntax(sess, resource, attributeToCheck); }
@Test public void testSemanticsWithNullValue() throws Exception { System.out.println("testSemanticsWithNullValue()"); attributeToCheck.setValue(null); classInstance.checkAttributeSyntax(sess, resource, attributeToCheck); }