urn_perun_facility_attribute_def_virt_GIDRanges extends FacilityVirtualAttributesModuleAbstract implements FacilityVirtualAttributesModuleImplApi { @Override public void checkAttributeSemantics(PerunSessionImpl sess, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException { try { Attribute gidNamespaceAttribute = getUnixGIDNamespaceAttribute(sess, facility); if(gidNamespaceAttribute.getValue() == null) throw new WrongReferenceAttributeValueException(attribute, gidNamespaceAttribute, "There is missing GID namespace on the facility."); Attribute namespaceGIDRangesAttribute = getNamespaceGIDRangesAttribute(sess, gidNamespaceAttribute.valueAsString()); sess.getPerunBl().getAttributesManagerBl().checkAttributeSemantics(sess, gidNamespaceAttribute.valueAsString(), namespaceGIDRangesAttribute); } catch(WrongReferenceAttributeValueException ex) { throw new WrongReferenceAttributeValueException(attribute, ex.getReferenceAttribute()); } }  @Override void checkAttributeSemantics(PerunSessionImpl sess, Facility facility, Attribute attribute); @Override Attribute getAttributeValue(PerunSessionImpl sess, Facility facility, AttributeDefinition attributeDefinition); @Override boolean setAttributeValue(PerunSessionImpl sess, Facility facility, Attribute attribute); @Override List<String> getDependencies(); @Override List<String> getStrongDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongReferenceAttributeValueException.class) public void testCheckAttributeSemanticsWithReqAttributeWithNullValue() throws Exception { System.out.println("testCheckAttributeSemanticsWithReqAttributeWithNullValue()"); reqAttribute.setValue(null); when(session.getPerunBl().getAttributesManagerBl().getAttribute(session, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":unixGID-namespace")).thenReturn(reqAttribute); classInstance.checkAttributeSemantics(session, facility, attributeToCheck); }
@Test public void testCheckAttributeSemanticsCorrect() throws Exception { System.out.println("testCheckAttributeSemanticsCorrect()"); reqAttribute.setValue("example"); when(session.getPerunBl().getAttributesManagerBl().getAttribute(session, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":unixGID-namespace")).thenReturn(reqAttribute); classInstance.checkAttributeSemantics(session, facility, attributeToCheck); }