Java Code Examples for javax.ejb.EJBException#getCausedByException()
The following examples show how to use
javax.ejb.EJBException#getCausedByException() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceProvisioningServiceBean2IT.java From development with Apache License 2.0 | 6 votes |
@Test(expected = SaaSSystemException.class) public void testSetCompatibleProductsTargetIsCopy() throws Exception { VOTechnicalService tp = createTechnicalProduct(svcProv); container.login(supplierUserKey, ROLE_SERVICE_MANAGER); VOService product1 = createProduct(tp, "1", svcProv); publishToLocalMarketplaceSupplier(product1, mpSupplier); VOServiceDetails product2 = createProduct(tp, "2", svcProv); publishToLocalMarketplaceSupplier(product2, mpSupplier); VOPriceModel priceModel = createPriceModel(); VOOrganization customer = getOrganizationForOrgId(customerOrgId); product2 = svcProv.savePriceModelForCustomer(product2, priceModel, customer); try { svcProv.setCompatibleServices(product1, Collections.singletonList((VOService) product2)); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 2
Source File: AuthorizationFilter.java From development with Apache License 2.0 | 6 votes |
private void handleServletException(HttpServletRequest httpRequest, HttpServletResponse httpResponse, ServletException e) throws IOException, ServletException { EJBException ejbEx = ExceptionHandler.getEJBException(e); if (ejbEx != null && ejbEx.getCause() instanceof Exception && ejbEx.getCausedByException() instanceof AccessException) { String forwardErrorPage; if (BesServletRequestReader.isMarketplaceRequest(httpRequest)) { forwardErrorPage = Marketplace.MARKETPLACE_ROOT + Constants.INSUFFICIENT_AUTHORITIES_URI; } else { forwardErrorPage = Constants.INSUFFICIENT_AUTHORITIES_URI; } JSFUtils.sendRedirect(httpResponse, httpRequest.getContextPath() + forwardErrorPage); } else { // make sure we do not catch exceptions cause by // ViewExpiredException here, they'll be handled directly in the // doFilter() throw e; } }
Example 3
Source File: ServiceProvisioningServiceBeanCopyIT.java From development with Apache License 2.0 | 6 votes |
private void validateCatalogEntry(final VOServiceDetails template, final VOServiceDetails copy) throws Exception { try { runTX(new Callable<Void>() { @Override public Void call() throws Exception { Product c1 = dataManager.getReference(Product.class, template.getKey()); Product c2 = dataManager.getReference(Product.class, copy.getKey()); assertEquals(1, c1.getCatalogEntries().size()); assertEquals(1, c2.getCatalogEntries().size()); CatalogEntry cCe1 = c1.getCatalogEntries().get(0); CatalogEntry cCe2 = c2.getCatalogEntries().get(0); assertTrue(cCe1.isAnonymousVisible() == cCe2 .isAnonymousVisible()); assertTrue(cCe1.isVisibleInCatalog() == cCe2 .isVisibleInCatalog()); return null; } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 4
Source File: ServiceProvisioningPotentialCompatibleServicesIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = EJBAccessException.class) public void getPotentialCompatibleServices_MarketplaceOwner() throws Exception { container.login(userKey, UserRoleType.MARKETPLACE_OWNER.name()); try { sps.getPotentialCompatibleServices(null); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 5
Source File: IdentityServiceBeanLdapWithDbIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void requestResetOfUserPassword_LDAPUsed() throws Exception { try { runTX(new Callable<Void>() { @Override public Void call() throws Exception { idMgmt.requestResetOfUserPassword( idMgmt.getCurrentUserDetails(), null); return null; } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 6
Source File: ServiceProvisioningServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = EJBAccessException.class) public void testSaveProductLocalizationWrongUserRole() throws Exception { try { // create product for the technical product container.login(providerUserKey, ROLE_TECHNOLOGY_MANAGER); final VOService productVO = createProduct(techProduct, PRODUCT_ID1, svcProv); container.login(providerUserKey, ROLE_MARKETPLACE_OWNER); svcProv.saveServiceLocalization(productVO, new VOServiceLocalization()); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 7
Source File: LdapSettingsMangementServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void getOrganizationSettings_nullOrgId() throws Throwable { try { runTX(new Callable<Void>() { @Override public Void call() throws Exception { ldapSettingsMgmtSvc.getOrganizationSettings(null); return null; } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 8
Source File: TriggerDefinitionServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
private void updateTriggerDefinition(VOTriggerDefinition vo) throws Exception { try { triggerDefinitionService.updateTriggerDefinition(vo); } catch (EJBException ex) { throw ex.getCausedByException(); } }
Example 9
Source File: PricedEventIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = ObjectNotFoundException.class) public void testDeleteWithSteppedPrice() throws Exception { runTX(new Callable<Void>() { public Void call() throws Exception { doTestAdd(); return null; } }); final SteppedPrice sp = addSteppedPrice(); runTX(new Callable<Void>() { public Void call() throws Exception { PricedEvent pe = mgr.getReference(PricedEvent.class, createdEvents.get(0).getKey()); mgr.remove(pe); return null; } }); try { runTX(new Callable<Void>() { public Void call() throws Exception { mgr.getReference(SteppedPrice.class, sp.getKey()); return null; } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 10
Source File: MarketplaceServiceBeanPublishServiceIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = ValidationException.class) public void publishService_EmptyMarketplaceIds() throws Exception { List<VOCatalogEntry> emptyList = Collections.emptyList(); try { container.login(supplier1Key, ROLE_SERVICE_MANAGER); marketplaceService.publishService(new VOService(), emptyList); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 11
Source File: LandingpageServiceBean2IT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void servicesForPublicLandingpage_anonymus_LocaleNull() throws Exception { // given try { // when landingpageService.servicesForPublicLandingpage(SUPPLIER_MP_ID, null); } catch (EJBException e) { // then throw e.getCausedByException(); } }
Example 12
Source File: MarketplaceServiceBeanPublishServiceIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = ValidationException.class) public void publishService_LocalAndGlobalMP() throws Exception { try { container.login(supplier1Key, ROLE_SERVICE_MANAGER); marketplaceService.publishService(new VOService(), Arrays.asList(voCESvc1_1, voCESvc1_2)); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 13
Source File: LdapSettingsMangementServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void getOrganizationSettingsResolved_nullOrgId() throws Throwable { try { runTX(new Callable<Void>() { @Override public Void call() throws Exception { ldapSettingsMgmtSvc.getOrganizationSettingsResolved(null); return null; } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 14
Source File: TechnicalProductImportParserIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = EJBAccessException.class) public void testImportTechnicalServicesAsSupplier() throws Exception { try { String xml = TSXML.createTSXMLWithEventAndParameter("param", ParameterValueType.INTEGER.name(), "1", "100", "50", "false", "true", "event", new String[] { "en", "en" }); container.login(createOrganization(OrganizationRoleType.SUPPLIER)); svcProv.importTechnicalServices(xml.getBytes("UTF-8")); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 15
Source File: UserManagementServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = EJBAccessException.class) public void resetOrganizationSettings_noOrgIdParam_PlatformOperator() throws Exception { container.login(1, ROLE_PLATFORM_OPERATOR); try { ums.resetOrganizationSettings(); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 16
Source File: ProductToPaymentTypeIT.java From development with Apache License 2.0 | 5 votes |
@Test public void testModify() throws Exception { try { runTX(new Callable<Void>() { @Override public Void call() throws Exception { doTestAdd(); return null; } }); final PaymentType newPt = runTX(new Callable<PaymentType>() { @Override public PaymentType call() throws Exception { ProductToPaymentType ref = mgr.getReference( ProductToPaymentType.class, prodToPt.getKey()); PaymentType pt = findPaymentType(INVOICE, mgr); ref.setPaymentType(pt); mgr.persist(ref); return pt; } }); runTX(new Callable<Void>() { @Override public Void call() throws Exception { doTestModifyCheck(newPt); return null; } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 17
Source File: TagServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = ObjectNotFoundException.class) public void testGetTag_NotFoundByLocale() throws Exception { setupTagData(); try { runTX(new Callable<Tag>() { @Override public Tag call() throws Exception { return tsLocal.getTag(createValue(LOCALE_DE, 0), LOCALE_EN); } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 18
Source File: TechnicalProductImportParserIT.java From development with Apache License 2.0 | 5 votes |
@Test public void testImportTechnicalServicesWithRoles() throws Exception { final String[] roleIds = new String[] { "ADMIN", "GUEST" }; String[] locales = new String[] { "de", "en" }; String xml = TSXML.createTSXMLWithRoles(roleIds, locales); svcProv.importTechnicalServices(xml.getBytes("UTF-8")); List<VOTechnicalService> list = svcProv .getTechnicalServices(OrganizationRoleType.TECHNOLOGY_PROVIDER); assertEquals(1, list.size()); final VOTechnicalService tp = list.get(0); try { runTX(new Callable<Void>() { @Override public Void call() throws Exception { TechnicalProduct reference = mgr .getReference(TechnicalProduct.class, tp.getKey()); List<RoleDefinition> roles = reference.getRoleDefinitions(); assertNotNull(roles); assertEquals(2, roles.size()); Set<String> ids = new HashSet<>(Arrays.asList(roleIds)); for (RoleDefinition role : roles) { assertTrue(ids.remove(role.getRoleId())); } assertTrue(ids.isEmpty()); return null; } }); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 19
Source File: ServiceProvisioningServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
/** * Check the execution of the suspend service method with a allowed user * role. (For reasons of simplification we pass null and expect a illegal * argument exception) */ @Test(expected = IllegalArgumentException.class) public void testSuspendService_validUserRole() throws Exception { container.login(supplierUserKey, ROLE_MARKETPLACE_OWNER); try { svcProv.suspendService(null, null); } catch (EJBException e) { throw e.getCausedByException(); } }
Example 20
Source File: UserManagementServiceBeanIT.java From development with Apache License 2.0 | 5 votes |
@Test(expected = EJBAccessException.class) public void getOrganizationSettingsResolved_StringParam_OrganizationAdmin() throws Exception { container.login(1, ROLE_ORGANIZATION_ADMIN); try { ums.getOrganizationSettingsResolved("orgId"); } catch (EJBException e) { throw e.getCausedByException(); } }