本文整理匯總了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();
}
}