<commit_before>package io.subutai.core.peer.impl;


import java.net.InetAddress;
import java.util.List;
import java.util.Set;
import java.util.UUID;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

import io.subutai.common.dao.DaoManager;
import io.subutai.common.peer.Peer;
import io.subutai.common.peer.PeerInfo;
import io.subutai.common.peer.PeerPolicy;
import io.subutai.common.peer.RequestListener;
import io.subutai.core.executor.api.CommandExecutor;
import io.subutai.core.hostregistry.api.HostRegistry;
import io.subutai.core.identity.api.IdentityManager;
import io.subutai.core.localpeer.impl.LocalPeerImpl;
import io.subutai.core.localpeer.impl.entity.ManagementHostEntity;
import io.subutai.core.localpeer.impl.request.MessageRequestListener;
import io.subutai.core.lxc.quota.api.QuotaManager;
import io.subutai.core.messenger.api.Messenger;
import io.subutai.core.metric.api.Monitor;
import io.subutai.core.peer.impl.command.CommandResponseListener;
import io.subutai.core.peer.impl.dao.PeerDAO;
import io.subutai.core.peer.impl.request.MessageResponseListener;
import io.subutai.core.security.api.SecurityManager;
import io.subutai.core.strategy.api.StrategyManager;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;


@RunWith( MockitoJUnitRunner.class )
public class PeerManagerImplTest
{
    private static final String PEER_ID_FILE = "./id";
    private static final String PEER_ID = UUID.randomUUID().toString();
    @Mock
    PeerDAO peerDAO;
    @Mock
    QuotaManager quotaManager;
    @Mock
    Monitor monitor;

    @Mock
    CommandExecutor commandExecutor;
    @Mock
    LocalPeerImpl localPeer;
    @Mock
    StrategyManager strategyManager;
    @Mock
    PeerInfo peerInfo;
    @Mock
    Messenger messenger;
    @Mock
    CommandResponseListener commandResponseListener;
    @Mock
    RequestListener requestListener;
    @Mock
    MessageResponseListener messageResponseListener;
    @Mock
    MessageRequestListener messageRequestListener;
    @Mock
    HostRegistry hostRegistry;
    @Mock
    DaoManager daoManager;
    @Mock
    IdentityManager identityManager;
    @Mock
    SecurityManager securityManager;
    @Mock
    ManagementHostEntity managementHost;
    @Mock
    Set<RequestListener> requestListeners;


    PeerManagerImpl peerManager;


    @Before
    public void setUp() throws Exception
    {
        peerManager =
                spy( new PeerManagerImpl( messenger, localPeer, daoManager, messageResponseListener, securityManager,
                        null ) );


        peerManager.commandResponseListener = commandResponseListener;
        peerManager.localPeer = localPeer;
        peerManager.peerDAO = peerDAO;

        when( peerManager.getLocalPeer() ).thenReturn( localPeer );<commit_msg>kurjun master integration SS-3083<commit_after>package io.subutai.core.peer.impl;


import java.net.InetAddress;
import java.util.List;
import java.util.Set;
import java.util.UUID;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

import io.subutai.common.dao.DaoManager;
import io.subutai.common.peer.Peer;
import io.subutai.common.peer.PeerInfo;
import io.subutai.common.peer.PeerPolicy;
import io.subutai.common.peer.RequestListener;
import io.subutai.core.executor.api.CommandExecutor;
import io.subutai.core.hostregistry.api.HostRegistry;
import io.subutai.core.identity.api.IdentityManager;
import io.subutai.core.kurjun.api.TemplateManager;
import io.subutai.core.localpeer.impl.LocalPeerImpl;
import io.subutai.core.localpeer.impl.entity.ManagementHostEntity;
import io.subutai.core.localpeer.impl.request.MessageRequestListener;
import io.subutai.core.lxc.quota.api.QuotaManager;
import io.subutai.core.messenger.api.Messenger;
import io.subutai.core.metric.api.Monitor;
import io.subutai.core.peer.impl.command.CommandResponseListener;
import io.subutai.core.peer.impl.dao.PeerDAO;
import io.subutai.core.peer.impl.request.MessageResponseListener;
import io.subutai.core.security.api.SecurityManager;
import io.subutai.core.strategy.api.StrategyManager;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;


@RunWith( MockitoJUnitRunner.class )
public class PeerManagerImplTest
{
    private static final String PEER_ID_FILE = "./id";
    private static final String PEER_ID = UUID.randomUUID().toString();
    @Mock
    PeerDAO peerDAO;
    @Mock
    QuotaManager quotaManager;
    @Mock
    Monitor monitor;

    @Mock
    CommandExecutor commandExecutor;
    @Mock
    LocalPeerImpl localPeer;
    @Mock
    StrategyManager strategyManager;
    @Mock
    PeerInfo peerInfo;
    @Mock
    Messenger messenger;
    @Mock
    CommandResponseListener commandResponseListener;
    @Mock
    RequestListener requestListener;
    @Mock
    MessageResponseListener messageResponseListener;
    @Mock
    MessageRequestListener messageRequestListener;
    @Mock
    HostRegistry hostRegistry;
    @Mock
    DaoManager daoManager;
    @Mock
    IdentityManager identityManager;
    @Mock
    SecurityManager securityManager;
    @Mock
    ManagementHostEntity managementHost;
    @Mock
    Set<RequestListener> requestListeners;
    @Mock
    TemplateManager templateManager;


    PeerManagerImpl peerManager;


    @Before
    public void setUp() throws Exception
    {
        peerManager =
                spy( new PeerManagerImpl( messenger, localPeer, daoManager, messageResponseListener, securityManager,
                        templateManager, null ) );


        peerManager.commandResponseListener = commandResponseListener;
        peerManager.localPeer = localPeer;
        peerManager.peerDAO = peerDAO;

        when( peerManager.getLocalPeer() ).thenReturn( localPeer );
{'fraction_non_alphanumeric': 0.08781988533072298, 'fraction_numerical': 0.0005593623269472801, 'mean_word_length': 4.3373134328358205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5569309', 'n_tokens_mistral': 2184, 'n_tokens_neox': 2145, 'n_words': 415}