urn_perun_user_attribute_def_virt_tcsMails_mu extends UserVirtualAttributesModuleAbstract implements UserVirtualAttributesModuleImplApi { @Override public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl perunSession, AuditEvent message) throws AttributeNotExistsException { List<AuditEvent> resolvingMessages = new ArrayList<>(); if (message instanceof AttributeSetForUser && isAffectedAttribute(((AttributeSetForUser) message).getAttribute().getFriendlyName())) { AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, this.getAttributeDefinition().getName()); resolvingMessages.add(new AttributeChangedForUser(new Attribute(attributeDefinition), ((AttributeSetForUser) message).getUser())); } else if (message instanceof AttributeRemovedForUser && isAffectedAttribute(((AttributeRemovedForUser) message).getAttribute().getFriendlyName())) { AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, this.getAttributeDefinition().getName()); resolvingMessages.add(new AttributeChangedForUser(new Attribute(attributeDefinition), ((AttributeRemovedForUser) message).getUser())); } else if (message instanceof AllAttributesRemovedForUser) { AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, this.getAttributeDefinition().getName()); resolvingMessages.add(new AttributeChangedForUser(new Attribute(attributeDefinition), ((AllAttributesRemovedForUser) message).getUser())); } return resolvingMessages; }  @Override Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition attributeDefinition); @Override List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl perunSession, AuditEvent message); @Override List<String> getStrongDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void resolveVirtualAttributeValueChangeSet1() throws Exception { AuditEvent userSet = new AttributeSetForUser(preferredMailAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeSet2() throws Exception { AuditEvent userSet = new AttributeSetForUser(isMailAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeSet3() throws Exception { AuditEvent userSet = new AttributeSetForUser(publicMailsAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeSet4() throws Exception { AuditEvent userSet = new AttributeSetForUser(privateMailsAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeSet5() throws Exception { AuditEvent userSet = new AttributeSetForUser(o365MailsAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeRemoved1() throws Exception { AuditEvent userRem = new AttributeRemovedForUser(preferredMailAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userRem); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeRemoved2() throws Exception { AuditEvent userRem = new AttributeRemovedForUser(isMailAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userRem); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeRemoved3() throws Exception { AuditEvent userRem = new AttributeRemovedForUser(publicMailsAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userRem); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeRemoved4() throws Exception { AuditEvent userRem = new AttributeRemovedForUser(privateMailsAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userRem); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeRemoved5() throws Exception { AuditEvent userRem = new AttributeRemovedForUser(o365MailsAttr, user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userRem); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }
@Test public void resolveVirtualAttributeValueChangeRemovedAll() throws Exception { AuditEvent allRemForUser = new AllAttributesRemovedForUser(user); List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, allRemForUser); assertTrue("audit should contain change of tcsMails",msgs.get(0).getMessage().contains(expectedTestOfMessage)); }