urn_perun_user_facility_attribute_def_virt_preferredUnixGroupName extends UserFacilityVirtualAttributesModuleAbstract implements UserFacilityVirtualAttributesModuleImplApi { @Override public void checkAttributeSemantics(PerunSessionImpl sess, User user, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException { try { Attribute facilityGroupNameNamespaceAttr = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, A_FACILITY_DEF_UNIX_GROUPNAME_NAMESPACE); if(facilityGroupNameNamespaceAttr.getValue() == null) { throw new WrongReferenceAttributeValueException(attribute, facilityGroupNameNamespaceAttr, user, facility, facility, null, "GroupName-namespace for racility cannot be null."); } String namespace = facilityGroupNameNamespaceAttr.valueAsString(); Attribute preferredUnixGroupNameAttr = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, A_USER_DEF_PREFERRED_UNIX_GROUPNAME_NAMESPACE + namespace); if(attribute.getValue() != null) { preferredUnixGroupNameAttr.setValue(attribute.getValue()); sess.getPerunBl().getAttributesManagerBl().checkAttributeSemantics(sess, user, preferredUnixGroupNameAttr); } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }  @Override void checkAttributeSemantics(PerunSessionImpl sess, User user, Facility facility, Attribute 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 testSemanticsWithoutFacilityLoginNamespaceAttribute() throws Exception { System.out.println("testSemanticsWithoutFacilityLoginNamespaceAttribute()"); attributeToCheck.setValue("name"); facilityGroupNameNamespace.setValue(null); classInstance.checkAttributeSemantics(sess, user, facility, attributeToCheck); }
@Test public void testSemanticsCorrect() throws Exception { System.out.println("testSemanticsCorrect()"); attributeToCheck.setValue("name"); classInstance.checkAttributeSemantics(sess, user, facility, attributeToCheck); }