<commit_before>/*
 * Copyright 2011 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl2.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kfs.module.endow.batch.service.impl;

import static org.kuali.kfs.sys.fixture.UserNameFixture.kfs;

import org.kuali.kfs.module.endow.businessobject.AutomatedCashInvestmentModel;
import org.kuali.kfs.module.endow.businessobject.CashSweepModel;
import org.kuali.kfs.module.endow.businessobject.ClassCode;
import org.kuali.kfs.module.endow.businessobject.EndowmentTransactionCode;
import org.kuali.kfs.module.endow.businessobject.GLLink;
import org.kuali.kfs.module.endow.businessobject.HoldingTaxLot;
import org.kuali.kfs.module.endow.businessobject.HoldingTaxLotRebalance;
import org.kuali.kfs.module.endow.businessobject.KEMID;
import org.kuali.kfs.module.endow.businessobject.KemidGeneralLedgerAccount;
import org.kuali.kfs.module.endow.businessobject.PooledFundControl;
import org.kuali.kfs.module.endow.businessobject.RegistrationCode;
import org.kuali.kfs.module.endow.businessobject.Security;
import org.kuali.kfs.module.endow.businessobject.SecurityReportingGroup;
import org.kuali.kfs.module.endow.document.AssetDecreaseDocument;
import org.kuali.kfs.module.endow.document.AssetIncreaseDocument;
import org.kuali.kfs.module.endow.document.service.UpdateAssetDecreaseDocumentTaxLotsService;
import org.kuali.kfs.module.endow.fixture.CashSweepModelFixture;
import org.kuali.kfs.module.endow.fixture.ClassCodeFixture;
import org.kuali.kfs.module.endow.fixture.CurrentCashFixture;
import org.kuali.kfs.module.endow.fixture.EndowmentTransactionCodeFixture;
import org.kuali.kfs.module.endow.fixture.GLLinkFixture;
import org.kuali.kfs.module.endow.fixture.HoldingTaxLotFixture;
import org.kuali.kfs.module.endow.fixture.HoldingTaxLotRebalanceFixture;
import org.kuali.kfs.module.endow.fixture.KemIdFixture;
import org.kuali.kfs.module.endow.fixture.KemidGeneralLedgerAccountFixture;
import org.kuali.kfs.module.endow.fixture.PooledFundControlTransactionFixture;
import org.kuali.kfs.module.endow.fixture.RegistrationCodeFixture;
import org.kuali.kfs.module.endow.fixture.SecurityFixture;
import org.kuali.kfs.module.endow.fixture.SecurityReportingGroupFixture;
import org.kuali.kfs.sys.ConfigureContext;
import org.kuali.kfs.sys.context.KualiTestBase;
import org.kuali.kfs.sys.context.SpringContext;
import org.kuali.kfs.sys.context.TestUtils;
import org.kuali.rice.kns.service.BusinessObjectService;

@ConfigureContext(session = kfs)
public class CreateCashSweepTransactionsServiceImplTest extends KualiTestBase {

    private AssetIncreaseDocument assetIncreaseDocument = null;
    private AssetDecreaseDocument assetDecreaseDocument = null;
    private CreateCashSweepTransactionsServiceImpl createCashSweepTransactionsService;
    private UpdateAssetDecreaseDocumentTaxLotsService assetDecreaseDocumentTaxLotsService;

    private Security security1;
    private Security security2;
    private AutomatedCashInvestmentModel aciModel;
    private PooledFundControl pooledFundControl;
    private RegistrationCode registrationCode;
    private EndowmentTransactionCode endowmentTransactionCode; 
    private KEMID kemid1;
    private KEMID kemid2;
    private CashSweepModel cashSweepModelSale;
    private CashSweepModel cashSweepModelPurchase;
    
    /**
     * @see junit.framework.TestCase#setUp()
     */
    @Override
    protected void setUp() throws Exception { 
        super.setUp();        

        BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
        createCashSweepTransactionsService = (CreateCashSweepTransactionsServiceImpl) TestUtils.getUnproxiedService("mockCreateCashSweepTransactionsService");
        assetDecreaseDocumentTaxLotsService = SpringContext.getBean(UpdateAssetDecreaseDocumentTaxLotsService.class);

        SecurityReportingGroup reportingGroup = SecurityReportingGroupFixture.REPORTING_GROUP.createSecurityReportingGroup();
        endowmentTransactionCode = EndowmentTransactionCodeFixture.ASSET_TRANSACTION_CODE2.createEndowmentTransactionCode();                
        ClassCode classCode = ClassCodeFixture.ASSET_CLASS_CODE.createClassCodeRecord();
        
        security1 = SecurityFixture.ENDOWMENT_ASSET_INCOME_SECURITY_RECORD.createSecurityRecord();
        security2 = SecurityFixture.ENDOWMENT_ASSET_PRINCIPAL_SECURITY_RECORD.createSecurityRecord();
        RegistrationCodeFixture.ASSET_REGISTRATION_CODE_RECORD_1.createRegistrationCode();
        RegistrationCodeFixture.ASSET_REGISTRATION_CODE_RECORD_2.createRegistrationCode();

        kemid1 = KemIdFixture.CSM_KEMID_RECORD_1.createKemidRecord();
        kemid2 = KemIdFixture.CSM_KEMID_RECORD_2.createKemidRecord();
      
        GLLink glLink = GLLinkFixture.GL_LINK_BL_CHART.createGLLink();
        KemidGeneralLedgerAccount generalLedgerAccount1 = KemidGeneralLedgerAccountFixture.KEMID_GL_ACCOUNT_FOR_ASSET1.createKemidGeneralLedgerAccount();
        KemidGeneralLedgerAccount generalLedgerAccount2 = KemidGeneralLedgerAccountFixture.KEMID_GL_ACCOUNT_FOR_ASSET2.createKemidGeneralLedgerAccount();
        kemid1.getKemidGeneralLedgerAccounts().add(generalLedgerAccount1);
        kemid2.getKemidGeneralLedgerAccounts().add(generalLedgerAccount2);
        
        endowmentTransactionCode.getGlLinks().add(glLink);

        PooledFundControl p1 = PooledFundControlTransactionFixture.ASSET_INCOME_DATA.createSavePooledFundControl();
        PooledFundControl p2 = PooledFundControlTransactionFixture.ASSET_PURCHASE_DATA.createSavePooledFundControl();
        
        cashSweepModelSale = CashSweepModelFixture.PRINCIPAL_SALE_DATA.createCashSweepModel();
        cashSweepModelPurchase = CashSweepModelFixture.PRINCIPAL_PURCHASE_DATA.createCashSweepModel();<commit_msg>KFSMI-6263: changed ASSET_TRANSACTION_CODE2 into ASSET_TRANSACTION_CODE_2<commit_after>/*
 * Copyright 2011 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl2.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kfs.module.endow.batch.service.impl;

import static org.kuali.kfs.sys.fixture.UserNameFixture.kfs;

import org.kuali.kfs.module.endow.businessobject.AutomatedCashInvestmentModel;
import org.kuali.kfs.module.endow.businessobject.CashSweepModel;
import org.kuali.kfs.module.endow.businessobject.ClassCode;
import org.kuali.kfs.module.endow.businessobject.EndowmentTransactionCode;
import org.kuali.kfs.module.endow.businessobject.GLLink;
import org.kuali.kfs.module.endow.businessobject.HoldingTaxLot;
import org.kuali.kfs.module.endow.businessobject.HoldingTaxLotRebalance;
import org.kuali.kfs.module.endow.businessobject.KEMID;
import org.kuali.kfs.module.endow.businessobject.KemidGeneralLedgerAccount;
import org.kuali.kfs.module.endow.businessobject.PooledFundControl;
import org.kuali.kfs.module.endow.businessobject.RegistrationCode;
import org.kuali.kfs.module.endow.businessobject.Security;
import org.kuali.kfs.module.endow.businessobject.SecurityReportingGroup;
import org.kuali.kfs.module.endow.document.AssetDecreaseDocument;
import org.kuali.kfs.module.endow.document.AssetIncreaseDocument;
import org.kuali.kfs.module.endow.document.service.UpdateAssetDecreaseDocumentTaxLotsService;
import org.kuali.kfs.module.endow.fixture.CashSweepModelFixture;
import org.kuali.kfs.module.endow.fixture.ClassCodeFixture;
import org.kuali.kfs.module.endow.fixture.CurrentCashFixture;
import org.kuali.kfs.module.endow.fixture.EndowmentTransactionCodeFixture;
import org.kuali.kfs.module.endow.fixture.GLLinkFixture;
import org.kuali.kfs.module.endow.fixture.HoldingTaxLotFixture;
import org.kuali.kfs.module.endow.fixture.HoldingTaxLotRebalanceFixture;
import org.kuali.kfs.module.endow.fixture.KemIdFixture;
import org.kuali.kfs.module.endow.fixture.KemidGeneralLedgerAccountFixture;
import org.kuali.kfs.module.endow.fixture.PooledFundControlTransactionFixture;
import org.kuali.kfs.module.endow.fixture.RegistrationCodeFixture;
import org.kuali.kfs.module.endow.fixture.SecurityFixture;
import org.kuali.kfs.module.endow.fixture.SecurityReportingGroupFixture;
import org.kuali.kfs.sys.ConfigureContext;
import org.kuali.kfs.sys.context.KualiTestBase;
import org.kuali.kfs.sys.context.SpringContext;
import org.kuali.kfs.sys.context.TestUtils;
import org.kuali.rice.kns.service.BusinessObjectService;

@ConfigureContext(session = kfs)
public class CreateCashSweepTransactionsServiceImplTest extends KualiTestBase {

    private AssetIncreaseDocument assetIncreaseDocument = null;
    private AssetDecreaseDocument assetDecreaseDocument = null;
    private CreateCashSweepTransactionsServiceImpl createCashSweepTransactionsService;
    private UpdateAssetDecreaseDocumentTaxLotsService assetDecreaseDocumentTaxLotsService;

    private Security security1;
    private Security security2;
    private AutomatedCashInvestmentModel aciModel;
    private PooledFundControl pooledFundControl;
    private RegistrationCode registrationCode;
    private EndowmentTransactionCode endowmentTransactionCode; 
    private KEMID kemid1;
    private KEMID kemid2;
    private CashSweepModel cashSweepModelSale;
    private CashSweepModel cashSweepModelPurchase;
    
    /**
     * @see junit.framework.TestCase#setUp()
     */
    @Override
    protected void setUp() throws Exception { 
        super.setUp();        

        BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
        createCashSweepTransactionsService = (CreateCashSweepTransactionsServiceImpl) TestUtils.getUnproxiedService("mockCreateCashSweepTransactionsService");
        assetDecreaseDocumentTaxLotsService = SpringContext.getBean(UpdateAssetDecreaseDocumentTaxLotsService.class);

        SecurityReportingGroup reportingGroup = SecurityReportingGroupFixture.REPORTING_GROUP.createSecurityReportingGroup();
        endowmentTransactionCode = EndowmentTransactionCodeFixture.ASSET_TRANSACTION_CODE_2.createEndowmentTransactionCode();                
        ClassCode classCode = ClassCodeFixture.ASSET_CLASS_CODE.createClassCodeRecord();
        
        security1 = SecurityFixture.ENDOWMENT_ASSET_INCOME_SECURITY_RECORD.createSecurityRecord();
        security2 = SecurityFixture.ENDOWMENT_ASSET_PRINCIPAL_SECURITY_RECORD.createSecurityRecord();
        RegistrationCodeFixture.ASSET_REGISTRATION_CODE_RECORD_1.createRegistrationCode();
        RegistrationCodeFixture.ASSET_REGISTRATION_CODE_RECORD_2.createRegistrationCode();

        kemid1 = KemIdFixture.CSM_KEMID_RECORD_1.createKemidRecord();
        kemid2 = KemIdFixture.CSM_KEMID_RECORD_2.createKemidRecord();
      
        GLLink glLink = GLLinkFixture.GL_LINK_BL_CHART.createGLLink();
        KemidGeneralLedgerAccount generalLedgerAccount1 = KemidGeneralLedgerAccountFixture.KEMID_GL_ACCOUNT_FOR_ASSET1.createKemidGeneralLedgerAccount();
        KemidGeneralLedgerAccount generalLedgerAccount2 = KemidGeneralLedgerAccountFixture.KEMID_GL_ACCOUNT_FOR_ASSET2.createKemidGeneralLedgerAccount();
        kemid1.getKemidGeneralLedgerAccounts().add(generalLedgerAccount1);
        kemid2.getKemidGeneralLedgerAccounts().add(generalLedgerAccount2);
        
        endowmentTransactionCode.getGlLinks().add(glLink);

        PooledFundControl p1 = PooledFundControlTransactionFixture.ASSET_INCOME_DATA.createSavePooledFundControl();
        PooledFundControl p2 = PooledFundControlTransactionFixture.ASSET_PURCHASE_DATA.createSavePooledFundControl();
        
        cashSweepModelSale = CashSweepModelFixture.PRINCIPAL_SALE_DATA.createCashSweepModel();
        cashSweepModelPurchase = CashSweepModelFixture.PRINCIPAL_PURCHASE_DATA.createCashSweepModel();
{'fraction_non_alphanumeric': 0.07432592709733533, 'fraction_numerical': 0.0052186289238554595, 'mean_word_length': 5.770877944325481, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '425501', 'n_tokens_mistral': 4141, 'n_tokens_neox': 4044, 'n_words': 535}