<commit_before>package eu.bcvsolutions.idm.core.bulk.action.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.google.common.collect.Sets;

import eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto;
import eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration;
import eu.bcvsolutions.idm.core.api.domain.IdentityState;
import eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto;
import eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto;
import eu.bcvsolutions.idm.core.api.dto.IdmRoleDto;
import eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter;
import eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter;
import eu.bcvsolutions.idm.core.api.service.IdmConfigurationService;
import eu.bcvsolutions.idm.core.api.service.IdmEntityEventService;
import eu.bcvsolutions.idm.core.api.service.IdmIdentityService;
import eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission;
import eu.bcvsolutions.idm.core.model.entity.IdmIdentity;
import eu.bcvsolutions.idm.core.model.event.IdentityEvent;
import eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission;
import eu.bcvsolutions.idm.test.api.AbstractBulkActionTest;

/**
 * Integration tests for {@link IdentitySaveBulkAction}
 *
 * @author <NAME> <<EMAIL>>
 *
 */

public class IdentitySaveBulkActionTest extends AbstractBulkActionTest {

	private String DELETE_PROCESSOR_KEY = "idm.sec.core.processor.entity-event-delete-executed-processor.enabled";
	private boolean originalAsynchronousValue = EventConfiguration.DEFAULT_EVENT_ASYNCHRONOUS_ENABLED;

	@Autowired
	private IdmIdentityService identityService;
	@Autowired
	private IdmEntityEventService entityEventService;
	@Autowired
	private IdmConfigurationService configurationService;
	@Autowired
	private EventConfiguration eventConfiguration;

	@Before
	public void login() {
		IdmIdentityDto identity = getHelper().createIdentity();

		IdmRoleDto createRole = getHelper().createRole();
		getHelper().createBasePolicy(createRole.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class,
				IdmBasePermission.READ, IdmBasePermission.UPDATE);

		getHelper().createIdentityRole(identity, createRole);
		loginAsNoAdmin(identity.getUsername());

		originalAsynchronousValue = eventConfiguration.isAsynchronous();
	}

	@After
	public void logout() {
		configurationService.setBooleanValue(DELETE_PROCESSOR_KEY, Boolean.TRUE);
		configurationService.setBooleanValue(EventConfiguration.PROPERTY_EVENT_ASYNCHRONOUS_ENABLED,
				originalAsynchronousValue);
		super.logout();<commit_msg>#636 try to fix tests<commit_after>package eu.bcvsolutions.idm.core.bulk.action.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.google.common.collect.Sets;

import eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto;
import eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration;
import eu.bcvsolutions.idm.core.api.domain.IdentityState;
import eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto;
import eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto;
import eu.bcvsolutions.idm.core.api.dto.IdmRoleDto;
import eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter;
import eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter;
import eu.bcvsolutions.idm.core.api.service.IdmConfigurationService;
import eu.bcvsolutions.idm.core.api.service.IdmEntityEventService;
import eu.bcvsolutions.idm.core.api.service.IdmIdentityService;
import eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission;
import eu.bcvsolutions.idm.core.model.entity.IdmIdentity;
import eu.bcvsolutions.idm.core.model.event.IdentityEvent;
import eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission;
import eu.bcvsolutions.idm.test.api.AbstractBulkActionTest;

/**
 * Integration tests for {@link IdentitySaveBulkAction}
 *
 * @author <NAME> <<EMAIL>>
 *
 */

public class IdentitySaveBulkActionTest extends AbstractBulkActionTest {

	private String DELETE_PROCESSOR_KEY = "idm.sec.core.processor.entity-event-delete-executed-processor.enabled";
	private boolean originalAsynchronousValue = EventConfiguration.DEFAULT_EVENT_ASYNCHRONOUS_ENABLED;

	@Autowired
	private IdmIdentityService identityService;
	@Autowired
	private IdmEntityEventService entityEventService;
	@Autowired
	private IdmConfigurationService configurationService;
	@Autowired
	private EventConfiguration eventConfiguration;

	@Before
	public void login() {
		IdmIdentityDto identity = getHelper().createIdentity();

		IdmRoleDto createRole = getHelper().createRole();
		getHelper().createBasePolicy(createRole.getId(), CoreGroupPermission.IDENTITY, IdmIdentity.class,
				IdmBasePermission.READ, IdmBasePermission.UPDATE);

		getHelper().createIdentityRole(identity, createRole);
		getHelper().login(identity.getUsername(), identity.getPassword());

		originalAsynchronousValue = eventConfiguration.isAsynchronous();
	}

	@After
	public void logout() {
		configurationService.setBooleanValue(DELETE_PROCESSOR_KEY, Boolean.TRUE);
		configurationService.setBooleanValue(EventConfiguration.PROPERTY_EVENT_ASYNCHRONOUS_ENABLED,
				originalAsynchronousValue);
		super.logout();
{'fraction_non_alphanumeric': 0.10212765957446808, 'fraction_numerical': 0.0005106382978723404, 'mean_word_length': 6.69109947643979, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7397868', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1864, 'n_words': 268}