Search in sources :

Example 6 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 resolveVirtualAttributeValueChangeRemoved2.

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

Example 7 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 resolveVirtualAttributeValueChangeSet1.

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

Example 8 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 resolveVirtualAttributeValueChangeSet3.

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

Example 9 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 resolveVirtualAttributeValueChangeRemoved1.

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

Example 10 with AuditEvent

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

the class AuditMessagesManagerImpl method pollConsumerEvents.

@Override
public List<AuditEvent> pollConsumerEvents(PerunSession perunSession, String consumerName, int lastProcessedId) {
    checkAuditerConsumerExists(perunSession, consumerName);
    try {
        List<AuditEvent> eventList = new ArrayList<>();
        int maxId = getLastMessageId(perunSession);
        if (maxId > lastProcessedId) {
            // get events
            eventList = jdbc.query("select " + auditMessageMappingSelectQuery + " from auditer_log where id > ? and id <= ? order by id", AUDIT_EVENT_MAPPER, lastProcessedId, maxId);
        }
        return eventList;
    } catch (Exception ex) {
        throw new InternalErrorException(ex);
    }
}
Also used : ArrayList(java.util.ArrayList) AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) EmptyResultDataAccessException(org.springframework.dao.EmptyResultDataAccessException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) SQLException(java.sql.SQLException) IOException(java.io.IOException) PerunException(cz.metacentrum.perun.core.api.exceptions.PerunException)

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