xmltype.XMLTypeTest.java Source code

Java tutorial

Introduction

Here is the source code for xmltype.XMLTypeTest.java

Source

/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * Copyright (c) 2013, MPL CodeInside http://codeinside.ru
 */

package xmltype;

import junit.framework.Assert;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang.time.DateUtils;
import org.junit.Before;
import org.junit.Test;
import ru.codeinside.gws.api.XmlTypes;
import ru.roskazna.xsd.budgetindex.BudgetIndex;
import ru.roskazna.xsd.charge.ChargeType;
import ru.roskazna.xsd.organization.Account;
import ru.roskazna.xsd.organization.Bank;
import ru.roskazna.xsd.organization.Organization;

import java.io.IOException;
import java.text.ParseException;
import java.util.Date;

public class XMLTypeTest {

    private ChargeType charge;

    @Before
    public void setUp() throws Exception {
        charge = createCharge();
    }

    private ChargeType createCharge() throws ParseException {
        final ChargeType charge = new ChargeType();

        charge.setSupplierBillID("19255500000000000079"); //   ?   TODO ,  ?      (Bill.xsd)
        Date billDate = DateUtils.parseDate("2011-03-10", new String[] { "yyyy-MM-dd" });
        charge.setBillDate(XmlTypes.date(DateFormatUtils.format(billDate, "dd.MM.yyyy"))); // ?? ?

        final Organization supplierOrgInfo = new Organization();
        supplierOrgInfo.setName(
                "   ?  ? ?");
        supplierOrgInfo.setINN("1655102196");
        supplierOrgInfo.setKPP("165501001");
        final Account account = new Account();
        account.setAccount("40101810800000010001");
        final Bank bank = new Bank();
        bank.setBIK("049205001");
        bank.setName(" ?  . ");
        account.setBank(bank);
        supplierOrgInfo.setAccount(account);
        charge.setSupplierOrgInfo(supplierOrgInfo);
        charge.setBillFor("?   ?");
        charge.setTotalAmount(100000L);
        charge.setChangeStatus(
                "1"); /* ? ? 1 -   2 -   3 -  */
        charge.setTreasureBranch("  ? ?"); //  ,  ?   ? ?? 
        charge.setKBK("19210806000011000110");
        charge.setOKATO("92401000000");

        final BudgetIndex budgetIndex = new BudgetIndex();
        budgetIndex.setStatus("0"); //?  //TODO   ? budgetIndex ? ?       ??  ??? ? ? ??
        budgetIndex.setPaymentType("0"); //  
        budgetIndex.setPurpose("0"); // ?  2 ? ?
        budgetIndex.setTaxPeriod("0"); //    10 ?
        budgetIndex.setTaxDocNumber("0"); //   
        budgetIndex.setTaxDocDate("0"); //   
        charge.setBudgetIndex(budgetIndex);

        charge.setApplicationID("455555"); //TODO ,  ?  ??           ?  20 ?
        charge.setUnifiedPayerIdentifier("0100000000006667775555643"); //    
        return charge;
    }
}