// Path: micro-asset/src/main/java/sample/microasset/context/orm/AssetRepository.java
// @Setter
// public class AssetRepository extends OrmRepository {
//     public static final String BeanNameDs = "assetDataSource";
//     public static final String BeanNameEmf = "assetEntityManagerFactory";
//     public static final String BeanNameTx = "assetTransactionManager";
// 
//     @PersistenceContext(unitName = BeanNameEmf)
//     private EntityManager em;
// 
//     @Override
//     public EntityManager em() {
//         return em;
//     }
// 
//     /** 資産スキーマのHibernateコンポーネントを生成します。 */
//     @ConfigurationProperties(prefix = "extension.datasource.asset")
//     @Data
//     @EqualsAndHashCode(callSuper = false)
//     public static class AssetDataSourceProperties extends OrmDataSourceProperties {
//         private OrmRepositoryProperties jpa = new OrmRepositoryProperties();
//         
//         public DataSource dataSource() {
//             return super.dataSource();
//         }
//         
//         public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(
//                 final DataSource dataSource) {
//             return jpa.entityManagerFactoryBean(BeanNameEmf, dataSource);
//         }
// 
//         public JpaTransactionManager transactionManager(final EntityManagerFactory emf) {
//             return jpa.transactionManager(emf);
//         }
//     }
// 
// }
// 
// Path: micro-asset/src/main/java/sample/microasset/model/AssetDataFixtures.java
// @Setter
// public class AssetDataFixtures {
//     
//     @Autowired
//     private Timestamper time;
//     @Autowired
//     private BusinessDayHandler businessDay;
//     @Autowired
//     private AssetRepository rep;
//     @Autowired
//     @Qualifier(AssetRepository.BeanNameTx)
//     private PlatformTransactionManager tx;
//     
//     @PostConstruct
//     public void initialize() {
//         new TransactionTemplate(tx).execute((status) -> {
//             initializeInTx();
//             return true;
//         });
//     }
//     
//     public void initializeInTx() {
//         String ccy = "JPY";
//         LocalDate baseDay = businessDay.day();
// 
//         // 口座資産: sample
//         cb("sample", baseDay, ccy, "1000000").save(rep);
//     }
//     
//     // asset
// 
//     /** 口座残高の簡易生成 */
//     public CashBalance cb(String accountId, LocalDate baseDay, String currency, String amount) {
//         return new CashBalance(null, accountId, baseDay, currency, new BigDecimal(amount), LocalDateTime.now());
//     }
// 
//     /** キャッシュフローの簡易生成 */
//     public Cashflow cf(String accountId, String amount, LocalDate eventDay, LocalDate valueDay) {
//         return cfReg(accountId, amount, valueDay).create(TimePoint.of(eventDay));
//     }
// 
//     /** キャッシュフロー登録パラメタの簡易生成 */
//     public RegCashflow cfReg(String accountId, String amount, LocalDate valueDay) {
//         return new RegCashflow(accountId, "JPY", new BigDecimal(amount), CashflowType.CashIn, "cashIn", null, valueDay);
//     }
// 
//     /** 振込入出金依頼の簡易生成 [発生日(T+1)/受渡日(T+3)] */
//     public CashInOut cio(String accountId, String absAmount, boolean withdrawal) {
//         TimePoint now = time.tp();
//         CashInOut m = new CashInOut();
//         m.setAccountId(accountId);
//         m.setCurrency("JPY");
//         m.setAbsAmount(new BigDecimal(absAmount));
//         m.setWithdrawal(withdrawal);
//         m.setRequestDay(now.getDay());
//         m.setRequestDate(now.getDate());
//         m.setEventDay(businessDay.day(1));
//         m.setValueDay(businessDay.day(3));
//         m.setTargetFiCode("tFiCode");
//         m.setTargetFiAccountId("tFiAccId");
//         m.setSelfFiCode("sFiCode");
//         m.setSelfFiAccountId("sFiAccId");
//         m.setStatusType(ActionStatusType.Unprocessed);
//         return m;
//     }
// 
// }


import java.time.Clock;
import java.util.*;
import java.util.function.Supplier;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.junit.*;
import org.springframework.orm.jpa.*;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
import sample.context.*;
import sample.context.actor.ActorSession;
import sample.context.orm.*;
import sample.context.orm.DefaultRepository.DefaultDataSourceProperties;
import sample.microasset.context.orm.AssetRepository;
import sample.microasset.model.AssetDataFixtures;
import sample.model.*;
import sample.support.MockDomainHelper;
package sample;





/**
 * Spring コンテナを用いない JPA のみに特化した検証用途。
 * <p>model パッケージでのみ利用してください。
 */
public class EntityTestSupport {
    protected Clock clock = Clock.systemDefaultZone();
    protected Timestamper time;
    protected BusinessDayHandler businessDay;
    protected PasswordEncoder encoder;
    protected ActorSession session;
    protected MockDomainHelper dh;
    protected EntityManagerFactory emf;
// Path: micro-asset/src/main/java/sample/microasset/context/orm/AssetRepository.java
// @Setter
// public class AssetRepository extends OrmRepository {
//     public static final String BeanNameDs = "assetDataSource";
//     public static final String BeanNameEmf = "assetEntityManagerFactory";
//     public static final String BeanNameTx = "assetTransactionManager";
// 
//     @PersistenceContext(unitName = BeanNameEmf)
//     private EntityManager em;
// 
//     @Override
//     public EntityManager em() {
//         return em;
//     }
// 
//     /** 資産スキーマのHibernateコンポーネントを生成します。 */
//     @ConfigurationProperties(prefix = "extension.datasource.asset")
//     @Data
//     @EqualsAndHashCode(callSuper = false)
//     public static class AssetDataSourceProperties extends OrmDataSourceProperties {
//         private OrmRepositoryProperties jpa = new OrmRepositoryProperties();
//         
//         public DataSource dataSource() {
//             return super.dataSource();
//         }
//         
//         public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(
//                 final DataSource dataSource) {
//             return jpa.entityManagerFactoryBean(BeanNameEmf, dataSource);
//         }
// 
//         public JpaTransactionManager transactionManager(final EntityManagerFactory emf) {
//             return jpa.transactionManager(emf);
//         }
//     }
// 
// }
// 
// Path: micro-asset/src/main/java/sample/microasset/model/AssetDataFixtures.java
// @Setter
// public class AssetDataFixtures {
//     
//     @Autowired
//     private Timestamper time;
//     @Autowired
//     private BusinessDayHandler businessDay;
//     @Autowired
//     private AssetRepository rep;
//     @Autowired
//     @Qualifier(AssetRepository.BeanNameTx)
//     private PlatformTransactionManager tx;
//     
//     @PostConstruct
//     public void initialize() {
//         new TransactionTemplate(tx).execute((status) -> {
//             initializeInTx();
//             return true;
//         });
//     }
//     
//     public void initializeInTx() {
//         String ccy = "JPY";
//         LocalDate baseDay = businessDay.day();
// 
//         // 口座資産: sample
//         cb("sample", baseDay, ccy, "1000000").save(rep);
//     }
//     
//     // asset
// 
//     /** 口座残高の簡易生成 */
//     public CashBalance cb(String accountId, LocalDate baseDay, String currency, String amount) {
//         return new CashBalance(null, accountId, baseDay, currency, new BigDecimal(amount), LocalDateTime.now());
//     }
// 
//     /** キャッシュフローの簡易生成 */
//     public Cashflow cf(String accountId, String amount, LocalDate eventDay, LocalDate valueDay) {
//         return cfReg(accountId, amount, valueDay).create(TimePoint.of(eventDay));
//     }
// 
//     /** キャッシュフロー登録パラメタの簡易生成 */
//     public RegCashflow cfReg(String accountId, String amount, LocalDate valueDay) {
//         return new RegCashflow(accountId, "JPY", new BigDecimal(amount), CashflowType.CashIn, "cashIn", null, valueDay);
//     }
// 
//     /** 振込入出金依頼の簡易生成 [発生日(T+1)/受渡日(T+3)] */
//     public CashInOut cio(String accountId, String absAmount, boolean withdrawal) {
//         TimePoint now = time.tp();
//         CashInOut m = new CashInOut();
//         m.setAccountId(accountId);
//         m.setCurrency("JPY");
//         m.setAbsAmount(new BigDecimal(absAmount));
//         m.setWithdrawal(withdrawal);
//         m.setRequestDay(now.getDay());
//         m.setRequestDate(now.getDate());
//         m.setEventDay(businessDay.day(1));
//         m.setValueDay(businessDay.day(3));
//         m.setTargetFiCode("tFiCode");
//         m.setTargetFiAccountId("tFiAccId");
//         m.setSelfFiCode("sFiCode");
//         m.setSelfFiAccountId("sFiAccId");
//         m.setStatusType(ActionStatusType.Unprocessed);
//         return m;
//     }
// 
// }


// Path: micro-asset/src/test/java/sample/EntityTestSupport.java
import java.time.Clock;
import java.util.*;
import java.util.function.Supplier;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.junit.*;
import org.springframework.orm.jpa.*;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
import sample.context.*;
import sample.context.actor.ActorSession;
import sample.context.orm.*;
import sample.context.orm.DefaultRepository.DefaultDataSourceProperties;
import sample.microasset.context.orm.AssetRepository;
import sample.microasset.model.AssetDataFixtures;
import sample.model.*;
import sample.support.MockDomainHelper;

package sample;





/**
 * Spring コンテナを用いない JPA のみに特化した検証用途。
 * <p>model パッケージでのみ利用してください。
 */
public class EntityTestSupport {
    protected Clock clock = Clock.systemDefaultZone();
    protected Timestamper time;
    protected BusinessDayHandler businessDay;
    protected PasswordEncoder encoder;
    protected ActorSession session;
    protected MockDomainHelper dh;
    protected EntityManagerFactory emf;
    protected AssetRepository rep;