urn_perun_user_facility_attribute_def_virt_UID extends UserFacilityVirtualAttributesModuleAbstract implements UserFacilityVirtualAttributesModuleImplApi { @Override public void checkAttributeSemantics(PerunSessionImpl sess, User user, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException { try { Attribute uidNamespaceAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":uid-namespace"); Attribute uidAttribute; if (uidNamespaceAttribute.getValue() != null) { uidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":uid-namespace:" + uidNamespaceAttribute.getValue()); uidAttribute.setValue(attribute.getValue()); sess.getPerunBl().getAttributesManagerBl().checkAttributeSemantics(sess, user, uidAttribute); } else { throw new WrongReferenceAttributeValueException(attribute, null, user, facility, "Required facility attribute uid-namespace value is null."); } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }  @Override void checkAttributeSemantics(PerunSessionImpl sess, User user, Facility facility, Attribute attribute); @Override Attribute fillAttribute(PerunSessionImpl sess, User user, Facility facility, AttributeDefinition attribute); @Override Attribute getAttributeValue(PerunSessionImpl sess, User user, Facility facility, AttributeDefinition attributeDefinition); @Override boolean setAttributeValue(PerunSessionImpl sess, User user, Facility facility, Attribute attribute); @Override List<String> getDependencies(); @Override List<String> getStrongDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongReferenceAttributeValueException.class) public void testSemanticsWithoutReqAttribute() throws Exception { System.out.println("testSemanticsWithoutReqAttribute()"); attributeToCheck.setValue("example"); reqAttribute.setValue(null); classInstance.checkAttributeSemantics(sess, user, facility, attributeToCheck); }
@Test public void testSemanticsCorrect() throws Exception { System.out.println("testSemanticsCorrect()"); attributeToCheck.setValue("example"); classInstance.checkAttributeSemantics(sess, user, facility, attributeToCheck); }