Package com.tll.model

Examples of com.tll.model.Account


  @Override
  public void doPersistDependentEntities() {
    final Currency currency = createAndPersist(Currency.class, true);

    Account account = create(Asp.class, true);
    account.setCurrency(currency);
    account.setParent(null);
    account = persist(account);
    pkAccount = account.getId();
    pkCurrency = currency.getId();

    Customer customer = create(Customer.class, true);
    customer.setParent(null);
    customer.setCurrency(currency);
View Full Code Here


  @Transactional
  @Override
  public void setAccountInterface(AccountInterface accountInterface) {

    final Account account = dao.load(Account.class, accountInterface.getAccountKey());
    final Interface intf = dao.load(Interface.class, accountInterface.getInterfaceKey());

    // remove existing account subscribed options
    IBusinessKey<InterfaceOptionAccount> bk;
    try {
View Full Code Here

   * Stub a valid account optionally persisting it in the datastore.
   * @param persist persist into datastore?
   * @return The stubbed account
   */
  protected final Account stubValidAccount(boolean persist) {
    Account account = null;

    getDbTrans().startTrans();
    getDbTrans().setComplete();
    try {
      final IEntityDao dao = getDao();

      account = getEntityBeanFactory().getEntityCopy(Asp.class);
      final AccountAddress aa = getEntityBeanFactory().getEntityCopy(AccountAddress.class);
      final Address a = getEntityBeanFactory().getEntityCopy(Address.class);
      aa.setAddress(a);
      account.addAccountAddress(aa);

      final Currency c = dao.persist(getEntityBeanFactory().getEntityCopy(Currency.class));
      account.setCurrency(c);

      pi = dao.persist(getEntityBeanFactory().getEntityCopy(PaymentInfo.class));
      account.setPaymentInfo(pi);

      if(persist) {
        account = dao.persist(account);
      }
    }
View Full Code Here

public class AccountInterfaceTest extends AbstractEntityServiceTest {

  public void testSetAccountInterface() throws Exception {
    final Interface intf = stubInterface(true);
    final InterfaceOption io = intf.getOptions().iterator().next();
    final Account a = stub(Asp.class, true);
    final AccountInterface ai = stubAccountInterface(intf, a, false);

    getInterfaceService().setAccountInterface(ai);

    BusinessKeyFactory bkf = new BusinessKeyFactory(new EntityMetadata());
    final IBusinessKey<InterfaceOptionAccount> bk = bkf.create(InterfaceOptionAccount.class, "Option Id and Account Id");
    bk.setPropertyValue("option.id", io.getId());
    bk.setPropertyValue("account.id", a.getId());
    final InterfaceOptionAccount ioa = getDao().load(bk);
    Assert.assertNotNull(ioa);
  }
View Full Code Here

    Assert.assertNotNull(ioa);
  }

  public void testLoadAccountInterface() throws Exception {
    final Interface intf = stubInterface(true);
    final Account a = stub(Asp.class, true);
    AccountInterface ai = stubAccountInterface(intf, a, true);

    ai = getInterfaceService().loadAccountInterface(a.getId(), intf.getId());

    Assert.assertNotNull(ai);
  }
View Full Code Here

    return intf;
  }

  private InterfaceOptionAccount stubIoa(Interface intf, boolean persist) {
    if(persist) getDbTrans().startTrans();
    final Account a = stub(Asp.class, false);
    final InterfaceOptionAccount ioa = stub(InterfaceOptionAccount.class, false);
    ioa.setAccount(a);
    ioa.setOption(intf.getOptions().iterator().next());
    if(persist) {
      getDbTrans().setComplete();
View Full Code Here

      throw new IllegalArgumentException("Unexpected invalid criteria exception occurred");
    }
    if(user == null) {
      throw new EntityNotFoundException("User with username: " + emailAddress + " was not found.");
    }
    final Account ua = user.getAccount();
    user.setAccount(ua);
    return user;
  }
View Full Code Here

   * Test the creation of an account history record.
   * @throws Exception
   */
  @Test
  public void testAccountHistoryRecordCreation() throws Exception {
    Account account = null;
    try {
      account = stubValidAccount(false);

      final IAccountService accountService = getEntityServiceFactory().instance(IAccountService.class);
      account = accountService.persist(account);

      getDbTrans().startTrans();
      final Criteria<AccountHistory> criteria = new Criteria<AccountHistory>(AccountHistory.class);
      criteria.getPrimaryGroup().addCriterion("account", Account.class, account.getId());
      final List<SearchResult> list = AbstractDbAwareTest.getEntitiesFromDb(getDao(), criteria);
      getDbTrans().endTrans();
      assert list != null && list.size() == 1;
    }
    catch(final Throwable t) {
View Full Code Here

   */
  @Test
  public void testAccountHistoryListHandlerDataProvider() throws Exception {
    final IAccountService accountService = getEntityServiceFactory().instance(IAccountService.class);

    Account account = stubValidAccount(false);
    account = accountService.persist(account);

    final IListingDataProvider<AccountHistory> dataProvider = accountService.getAccountHistoryDataProvider();

    final Criteria<AccountHistory> criteria = new Criteria<AccountHistory>(AccountHistory.class);
    criteria.getPrimaryGroup().addCriterion("account", Account.class, account.getId());

    final Sorting sorting = new Sorting("transDate");

    final IListHandler<SearchResult> lh =
      ListHandlerFactory.create(criteria, sorting, ListHandlerType.PAGE, dataProvider);
View Full Code Here

    }
  }

  @Test
  public void testUserCreate() throws Exception {
    Account account = null;
    try {
      // stub the related account
      account = stubValidAccount(true);

      // stub the authorities
View Full Code Here

TOP

Related Classes of com.tll.model.Account

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.