<commit_before>package org.dasein.cloud.vsphere;

import mockit.Mock;
import mockit.MockUp;
import mockit.Mocked;
import mockit.NonStrictExpectations;
import mockit.integration.junit4.JMockit;

import org.apache.http.StatusLine;
import org.apache.log4j.Logger;
import org.dasein.cloud.ProviderContext;
import org.dasein.cloud.compute.AffinityGroupSupport;
import org.dasein.cloud.vsphere.compute.Vm;
import org.dasein.cloud.vsphere.compute.VsphereCompute;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import com.vmware.vim25.InvalidPropertyFaultMsg;
import com.vmware.vim25.RuntimeFaultFaultMsg;
import com.vmware.vim25.ServiceContent;
import com.vmware.vim25.UserSession;
import com.vmware.vim25.VimPortType;
import com.vmware.vim25.VimService;


/**
 * User: daniellemayne
 * Date: 16/09/2015
 * Time: 13:43
 */
@RunWith(JMockit.class)
public class VsphereTestBase {
    @Mocked
    ProviderContext providerContextMock;
    @Mocked
    Vsphere vsphereMock;
    @Mocked
    Logger logger;
    @Mocked
    VsphereConnection connectionMock;
    @Mocked
    VimPortType vimPortMock;
    @Mocked 
    VimService vimServiceMock;
    @Mocked 
    UserSession userSessionMock;
    @Mocked
    ServiceContent serviceContentMock;

    protected final String ACCOUNT_NO = "TESTACCOUNTNO";
    protected final String REGION = "datacenter-21";
    protected final String ENDPOINT = "TESTENDPOINT";

    @Before
    public void setUp() throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
        new NonStrictExpectations() {
            { vsphereMock.getContext(); result = providerContextMock; }
        };

        new NonStrictExpectations() {
            { providerContextMock.getAccountNumber(); result = ACCOUNT_NO; }
            { providerContextMock.getRegionId(); result = REGION; }
            { providerContextMock.getEndpoint(); result = ENDPOINT;}
        };

        new NonStrictExpectations() {
            { connectionMock.getVimPort(); result = vimPortMock;}<commit_msg>cleaned up setUp to cope with all exceptions<commit_after>package org.dasein.cloud.vsphere;

import mockit.Mock;
import mockit.MockUp;
import mockit.Mocked;
import mockit.NonStrictExpectations;
import mockit.integration.junit4.JMockit;

import org.apache.http.StatusLine;
import org.apache.log4j.Logger;
import org.dasein.cloud.ProviderContext;
import org.dasein.cloud.compute.AffinityGroupSupport;
import org.dasein.cloud.vsphere.compute.Vm;
import org.dasein.cloud.vsphere.compute.VsphereCompute;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import com.vmware.vim25.InvalidPropertyFaultMsg;
import com.vmware.vim25.RuntimeFaultFaultMsg;
import com.vmware.vim25.ServiceContent;
import com.vmware.vim25.UserSession;
import com.vmware.vim25.VimPortType;
import com.vmware.vim25.VimService;


/**
 * User: daniellemayne
 * Date: 16/09/2015
 * Time: 13:43
 */
@RunWith(JMockit.class)
public class VsphereTestBase {
    @Mocked
    ProviderContext providerContextMock;
    @Mocked
    Vsphere vsphereMock;
    @Mocked
    Logger logger;
    @Mocked
    VsphereConnection connectionMock;
    @Mocked
    VimPortType vimPortMock;
    @Mocked 
    VimService vimServiceMock;
    @Mocked 
    UserSession userSessionMock;
    @Mocked
    ServiceContent serviceContentMock;

    protected final String ACCOUNT_NO = "TESTACCOUNTNO";
    protected final String REGION = "datacenter-21";
    protected final String ENDPOINT = "TESTENDPOINT";

    @Before
    public void setUp() throws Exception {
        new NonStrictExpectations() {
            { vsphereMock.getContext(); result = providerContextMock; }
        };

        new NonStrictExpectations() {
            { providerContextMock.getAccountNumber(); result = ACCOUNT_NO; }
            { providerContextMock.getRegionId(); result = REGION; }
            { providerContextMock.getEndpoint(); result = ENDPOINT;}
        };

        new NonStrictExpectations() {
            { connectionMock.getVimPort(); result = vimPortMock;}
{'fraction_non_alphanumeric': 0.09310940973079773, 'fraction_numerical': 0.014324524573968881, 'mean_word_length': 3.838709677419355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4890730', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1254, 'n_words': 243}