本文整理汇总了Java中javax.ejb.EJBException.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java EJBException.getCause方法的具体用法?Java EJBException.getCause怎么用?Java EJBException.getCause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ejb.EJBException
的用法示例。
在下文中一共展示了EJBException.getCause方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveEnterpriseLandingpageConfig_invalidRole
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* User must have "MARKETPLACE_OWNER" role
*/
@Test(expected = EJBAccessException.class)
public void saveEnterpriseLandingpageConfig_invalidRole() throws Throwable {
// given wrong role
String invalidRole = UserRoleType.ORGANIZATION_ADMIN.name();
container.login(mpOwnerUserKey, invalidRole);
// when saving, then exception must be thrown
try {
landingpageServiceLocal
.saveEnterpriseLandingpageConfig(MARKETPLACEID);
} catch (EJBException e) {
throw e.getCause();
}
}
示例2: testAdd
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* <b>Test case:</b> Add a new product review entry<br>
* <b>ExpectedResult:</b>
* <ul>
* <li>The product review entry can be retrieved from DB and is identical to
* the provided object</li>
* <li>A history object is created for the product review entry</li>
* </ul>
*
* @throws Exception
*/
@Test
public void testAdd() throws Throwable {
try {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
createProductReview();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestAddCheck();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例3: testViolateUniqueConstraint
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* <b>Testcase:</b> Try to insert two organizations with the same
* organizationId<br>
* <b>ExpectedResult:</b> SaasNonUniqueBusinessKeyException
*
* @throws Throwable
*/
@Test(expected = NonUniqueBusinessKeyException.class)
public void testViolateUniqueConstraint() throws Throwable {
try {
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestViolateUniqueConstraintPrepare();
return null;
}
});
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestViolateUniqueConstraint();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例4: testViolateUniqueConstraintSameOrganizationInOneTX
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* <b>Testcase:</b> Try to insert two Users with the same login for the same
* organization<br>
* <b>ExpectedResult:</b> SaasNonUniqueBusinessKeyException
*
* @throws Throwable
*/
@Test(expected = NonUniqueBusinessKeyException.class)
public void testViolateUniqueConstraintSameOrganizationInOneTX()
throws Throwable {
try {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestViolateUniqueConstraintInOneTX();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例5: testViolateUniqueConstraint
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* <b>Testcase:</b> Try to insert two Subscription with the same
* subscriptionId<br>
* <b>ExpectedResult:</b> SaasNonUniqueBusinessKeyException
*
* @throws Throwable
*/
@Test(expected = NonUniqueBusinessKeyException.class)
public void testViolateUniqueConstraint() throws Throwable {
try {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestViolateUniqueConstraintPrepare();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestViolateUniqueConstraint();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例6: add
import javax.ejb.EJBException; //导入方法依赖的package包/类
@Test
public void add() throws Throwable {
try {
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestAdd();
return null;
}
});
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestAddCheck();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例7: getRevenueShareData_InvalidRoleOrganizationAdmin
import javax.ejb.EJBException; //导入方法依赖的package包/类
@Test(expected = EJBAccessException.class)
public void getRevenueShareData_InvalidRoleOrganizationAdmin()
throws Exception {
// given no revenue share result entries. Login with invalid user role
container.login(brokerUser.getKey(), ROLE_ORGANIZATION_ADMIN);
// when
try {
bs.getRevenueShareData(Long.valueOf(PERIOD_START_MONTH1),
Long.valueOf(PERIOD_END_MONTH1),
BillingSharesResultType.BROKER);
fail();
} catch (EJBException e) {
throw (EJBAccessException) e.getCause();
}
}
示例8: testModify
import javax.ejb.EJBException; //导入方法依赖的package包/类
@Test
public void testModify() throws Throwable {
try {
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestAdd();
return null;
}
});
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestModify();
return null;
}
});
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestModifyCheck();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例9: testDelete
import javax.ejb.EJBException; //导入方法依赖的package包/类
@Test
public void testDelete() throws Throwable {
try {
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestDeletePrepare();
return null;
}
});
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestDelete();
return null;
}
});
runTX(new Callable<Void>() {
public Void call() throws Exception {
doTestDeleteCheck();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例10: testGetGlobalByOwner
import javax.ejb.EJBException; //导入方法依赖的package包/类
@Test
public void testGetGlobalByOwner() throws Throwable {
try {
runTX(new Callable<Void>() {
public Void call() throws Exception {
Marketplace marketplace = Marketplaces
.findOneGlobalMarketplace(mgr);
Assert.assertNotNull("No marketplace found", marketplace);
Assert.assertNotNull("No owner set",
marketplace.getOrganization());
Query query = mgr
.createNamedQuery("Marketplace.getByOwner");
String oId = marketplace.getOrganization()
.getOrganizationId();
query.setParameter("organizationId", oId);
List<Marketplace> result = ParameterizedTypes.list(
query.getResultList(), Marketplace.class);
Assert.assertNotNull("No marketplace found", result);
Assert.assertTrue("No marketplace found", result.size() > 0);
for (Marketplace mp : result) {
Assert.assertNotNull("No owner set",
mp.getOrganization());
Assert.assertEquals("Wrong owner - ", oId, mp
.getOrganization().getOrganizationId());
}
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例11: testSearchServices_NullLocale
import javax.ejb.EJBException; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testSearchServices_NullLocale() throws Throwable {
try {
search.searchServices(FUJITSU, null, "wicked_de");
} catch (EJBException e) {
throw e.getCause();
}
Assert.fail();
}
示例12: testSearchServices_EmptyLocale
import javax.ejb.EJBException; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testSearchServices_EmptyLocale() throws Throwable {
try {
search.searchServices(FUJITSU, "", "wicked_de");
} catch (EJBException e) {
throw e.getCause();
}
Assert.fail();
}
示例13: testModifyUser
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* <b>Testcase:</b> Modify an existing PlatformUser object <br>
* <b>ExpectedResult:</b>
* <ul>
* <li>Modification is saved to the DB</li>
* <li>History object created for the platformUser</li>
* <li>No new history object for Organization</li>
* </ul>
*
* @throws Throwable
*/
@Test
public void testModifyUser() throws Throwable {
try {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModifyUserPrepare();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModifyUser();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModifyUserCheck();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例14: testModify
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* <b>Testcase:</b> Modify the list of supported country codes for an
* existing organization object <br>
* <b>ExpectedResult:</b>
* <ul>
* <li>Modification is saved to the DB</li>
* <li>History object created for the country codes</li>
* </ul>
*
* @throws Throwable
*/
@Test
public void testModify() throws Throwable {
try {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModifyPrepare();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModify();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModifyCheck();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}
示例15: testModify
import javax.ejb.EJBException; //导入方法依赖的package包/类
/**
* <b>Testcase:</b> Modify an existing product review object <br>
* <b>ExpectedResult:</b>
* <ul>
* <li>Modification is saved to the DB</li>
* <li>History object created for the product review</li>
* <li>PlatformUser unchanged</li>
* <li>No new history object for PlatformUser</li>
* </ul>
*
* @throws Throwable
*/
@Test
public void testModify() throws Throwable {
try {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
createProductReview();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModify();
return null;
}
});
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
doTestModifyCheck();
return null;
}
});
} catch (EJBException e) {
throw e.getCause();
}
}