urn_perun_user_facility_attribute_def_virt_defaultUnixGID extends UserFacilityVirtualAttributesModuleAbstract implements UserFacilityVirtualAttributesModuleImplApi { @Override public void checkAttributeSemantics(PerunSessionImpl perunSession, User user, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if(attribute.getValue() == null) throw new WrongReferenceAttributeValueException(attribute, null, user, facility, "Attribute can't be null."); try { Attribute defaultUnixGID = perunSession.getPerunBl().getAttributesManagerBl().getAttribute(perunSession, facility, user, AttributesManager.NS_USER_FACILITY_ATTR_DEF + ":defaultUnixGID"); defaultUnixGID.setValue(attribute.getValue()); perunSession.getPerunBl().getAttributesManagerBl().checkAttributeSemantics(perunSession, facility, user, defaultUnixGID); } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } }  @Override Attribute getAttributeValue(PerunSessionImpl sess, User user, Facility facility, AttributeDefinition attributeDefinition); @Override void checkAttributeSemantics(PerunSessionImpl perunSession, User user, Facility facility, Attribute attribute); @Override boolean setAttributeValue(PerunSessionImpl sess, User user, Facility facility, Attribute attribute); @Override List<String> getStrongDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongReferenceAttributeValueException.class) public void testSemanticsWithoutReqAttribute() throws Exception { System.out.println("testSemanticsWithoutReqAttribute()"); Attribute attributeToCheck = new Attribute(); classInstance.checkAttributeSemantics(session, user, facility, attributeToCheck); }
@Test public void testSemanticsCorrect() throws Exception { System.out.println("testSemanticsCorrect()"); Attribute attributeToCheck = new Attribute(); attributeToCheck.setValue(5); classInstance.checkAttributeSemantics(session, user, facility, attributeToCheck); }