本文整理汇总了Java中org.kuali.rice.krad.test.document.bo.AccountExtension.setAccountTypeCode方法的典型用法代码示例。如果您正苦于以下问题:Java AccountExtension.setAccountTypeCode方法的具体用法?Java AccountExtension.setAccountTypeCode怎么用?Java AccountExtension.setAccountTypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.test.document.bo.AccountExtension
的用法示例。
在下文中一共展示了AccountExtension.setAccountTypeCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLazyRefreshField
import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
/**
* tests that {@link PersistableBusinessObjectBase#refreshReferenceObject(String)} works for a lazy loaded reference when the foreign key is changed
*/
public void testLazyRefreshField() {
final String number = "a1";
AccountExtension accountExtension = KNSServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(AccountExtension.class, number);
assertNotNull( "Unable to retrieve account extension a1", accountExtension );
assertEquals("Retrieved account extension should have an account type of IAT", "IAT",
accountExtension.getAccountType().getAccountTypeCode());
assertEquals("Retrieved account extension should have an account type name of Income Account Type",
"Income Account Type", accountExtension.getAccountType().getName());
accountExtension.setAccountTypeCode("CAT");
accountExtension.refreshReferenceObject("accountType");
assertEquals("Account extension should now have an account type name of Clearing Account Type",
"Clearing Account Type", accountExtension.getAccountType().getName());
}
示例2: testLazyRefreshWholeObject
import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
/**
* tests that {@link PersistableBusinessObjectBase#refresh()} works for a lazy loaded reference when the foreign key is changed
*/
public void testLazyRefreshWholeObject() {
final String number = "a1";
AccountExtension accountExtension = KNSServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(AccountExtension.class, number);
assertNotNull( "Unable to retrieve account extension a1", accountExtension );
assertEquals("Retrieved account extension should have account type IAT", "IAT",
accountExtension.getAccountType().getAccountTypeCode());
assertEquals("Retrieved account extension should have an account type name of Income Account Type",
"Income Account Type", accountExtension.getAccountType().getName());
accountExtension.setAccountTypeCode("CAT");
accountExtension.refresh();
assertEquals("Account extension should now have an account type name of Clearing Account Type",
"Clearing Account Type", accountExtension.getAccountType().getName());
}
示例3: testExistsSubQueryCriteria
import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
public void testExistsSubQueryCriteria() {
Logger.getLogger(getClass()).info( "Adding Account" );
Account acct = new Account();
acct.setNumber("a1");
acct.setName("a1 name");
provider.save(acct, PersistenceOption.FLUSH);
Logger.getLogger(getClass()).info( "Testing Account Saved" );
acct = provider.find(Account.class, "a1");
assertNotNull( "a1 SimpleAccount missing", acct );
/*
* Testing query of form:
*
* SELECT * FROM SimpleAccount WHERE EXISTS ( SELECT 'x' FROM SimpleAccountExtension WHERE SimpleAccountExtension.number = SimpleAccount.number )
*/
Predicate subquery = PredicateFactory.existsSubquery(AccountExtension.class.getName(), PredicateFactory.equalsProperty("number", null, "parent.number"));
QueryByCriteria q = QueryByCriteria.Builder.fromPredicates(subquery);
Logger.getLogger(getClass()).info( "Performing Lookup with Exists Query: " + q );
QueryResults<Account> results = provider.findMatching(Account.class, q);
assertNotNull( "Results should not have been null", results );
assertEquals( "Should have been no results in the default data", 0, results.getResults().size() );
Logger.getLogger(getClass()).info( "Building extension object for retest" );
AccountExtension ext = new AccountExtension();
ext.setAccount(acct);
ext.setAccountTypeCode("EAX");
provider.save(ext, PersistenceOption.FLUSH);
Logger.getLogger(getClass()).info( "Running query again to test results" );
results = provider.findMatching(Account.class, q);
assertNotNull( "Results should not have been null", results );
assertEquals( "We added an extension record, so there should have been one result", 1, results.getResults().size() );
}
示例4: testNotExistsSubQueryCriteria
import org.kuali.rice.krad.test.document.bo.AccountExtension; //导入方法依赖的package包/类
@Test
public void testNotExistsSubQueryCriteria() {
Logger.getLogger(getClass()).info( "Adding Account1" );
Account acct = new Account();
acct.setNumber("a1");
acct.setName("a1 name");
provider.save(acct, PersistenceOption.FLUSH);
Logger.getLogger(getClass()).info( "Adding Account2" );
Account acct2 = new Account();
acct.setNumber("a2");
acct.setName("a2 name");
provider.save(acct, PersistenceOption.FLUSH);
acct = null;
Logger.getLogger(getClass()).info( "Testing Account1 Saved" );
acct = provider.find(Account.class, "a1");
assertNotNull( "a1 SimpleAccount missing", acct );
acct2 = null;
Logger.getLogger(getClass()).info( "Testing Account2 Saved" );
acct2 = provider.find(Account.class, "a2");
assertNotNull( "a2 SimpleAccount missing", acct2 );
// Just a1 has an AccountExtension
Logger.getLogger(getClass()).info( "Building extension object for retest" );
AccountExtension ext = new AccountExtension();
ext.setAccount(acct);
ext.setAccountTypeCode("EAX");
provider.save(ext, PersistenceOption.FLUSH);
/*
* Testing query of form:
*
* SELECT * FROM SimpleAccount WHERE NOT EXISTS ( SELECT 'x' FROM SimpleAccountExtension WHERE SimpleAccountExtension.number = SimpleAccount.number )
*/
Predicate subquery = PredicateFactory.notExistsSubquery(AccountExtension.class.getName(),
PredicateFactory.equalsProperty("number", null, "parent.number"));
QueryByCriteria q = QueryByCriteria.Builder.fromPredicates(subquery);
Logger.getLogger(getClass()).info( "Performing Lookup with Exists Query: " + q );
QueryResults<Account> results = provider.findMatching(Account.class, q);
assertNotNull( "Results should not have been null", results );
assertEquals( "Should have been one result in the default data", 1, results.getResults().size() );
assertEquals(" A2 should be returned for not exists", results.getResults().get(0).getNumber(), "a2");
// Now acct2 also has AccountExtension
Logger.getLogger(getClass()).info( "Building extension object for retest" );
AccountExtension ext2 = new AccountExtension();
ext2.setAccount(acct2);
ext2.setAccountTypeCode("EAX2");
provider.save(ext2, PersistenceOption.FLUSH);
Logger.getLogger(getClass()).info( "Running query again to test results" );
results = provider.findMatching(Account.class, q);
assertNotNull( "Results should not have been null", results );
assertEquals( "We added an extension record, so there should have been no result", 0, results.getResults().size() );
}