Search in sources :

Example 31 with AuditEvent

use of cz.metacentrum.perun.audit.events.AuditEvent in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeRemoved3.

@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));
}
Also used : AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) AttributeRemovedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser) Test(org.junit.Test)

Example 32 with AuditEvent

use of cz.metacentrum.perun.audit.events.AuditEvent in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeRemoved4.

@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));
}
Also used : AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) AttributeRemovedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser) Test(org.junit.Test)

Example 33 with AuditEvent

use of cz.metacentrum.perun.audit.events.AuditEvent in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_institutionsCountriesTest method resolveVirtualAttributeValueChange2.

@Test
public void resolveVirtualAttributeValueChange2() throws Exception {
    setSchacHomeOrgs("muni.cz;cesnet.cz");
    String czech_republic = "Czech Republic";
    dnsMap.put(".cz", czech_republic);
    AttributeDefinition countries = classInstance.getAttributeDefinition();
    when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, "urn:perun:user:attribute-def:virt:institutionsCountries")).thenReturn(countries);
    Attribute newval = new Attribute(new urn_perun_entityless_attribute_def_def_dnsStateMapping().getAttributeDefinition());
    newval.setValue(czech_republic);
    when(sess.getPerunBl().getUsersManagerBl().findUsersWithExtSourceAttributeValueEnding(eq(sess), eq(SCHAC_HOME_ATTR_NAME), eq(".cz"), any())).thenReturn(Collections.singletonList(user));
    AuditEvent event = new AttributeSetForKey(newval, ".cz");
    List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, event);
    assertTrue("audit should contain change of institutionsCountries", msgs.get(0).getMessage().contains("friendlyName=<institutionsCountries>"));
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) AttributeSetForKey(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForKey) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) Test(org.junit.Test)

Aggregations

AuditEvent (cz.metacentrum.perun.audit.events.AuditEvent)33 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)11 Attribute (cz.metacentrum.perun.core.api.Attribute)9 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)9 AttributeSetForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser)8 AttributeRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser)7 User (cz.metacentrum.perun.core.api.User)7 AttributeChangedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForUser)5 AllAttributesRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUser)4 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)4 UserNotExistsException (cz.metacentrum.perun.core.api.exceptions.UserNotExistsException)4 EnrichedSponsorship (cz.metacentrum.perun.core.api.EnrichedSponsorship)3 Facility (cz.metacentrum.perun.core.api.Facility)3 Member (cz.metacentrum.perun.core.api.Member)3 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)3 JsonParseException (com.fasterxml.jackson.core.JsonParseException)2 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)2 AttributeChangedForFacility (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForFacility)2 AttributeChangedForResourceAndMember (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForResourceAndMember)2