Java 类javax.ejb.EJBException 实例源码

项目:sample.daytrader3    文件:TradeSLSBBean.java   
private OrderDataBean createOrder(AccountDataBean account, QuoteDataBean quote, HoldingDataBean holding, String orderType, double quantity) {

        OrderDataBean order;

        if (Log.doTrace())
            Log.trace("TradeSLSBBean:createOrder(orderID="
                      + " account=" + ((account == null) ? null : account.getAccountID())
                      + " quote=" + ((quote == null) ? null : quote.getSymbol())
                      + " orderType=" + orderType
                      + " quantity=" + quantity);
        try {
            order = new OrderDataBean(orderType, "open", new Timestamp(System.currentTimeMillis()), null, quantity, quote.getPrice().setScale(FinancialUtils.SCALE,
                                                                                                                                              FinancialUtils.ROUND),
                            TradeConfig.getOrderFee(orderType), account, quote, holding);
            entityManager.persist(order);
        } catch (Exception e) {
            Log.error("TradeSLSBBean:createOrder -- failed to create Order", e);
            throw new EJBException("TradeSLSBBean:createOrder -- failed to create Order", e);
        }
        return order;
    }
项目:oscm    文件:DataServiceBeanIT.java   
@Test(expected = InvalidUserSession.class)
public void testGetCurrentUserExistingButNoAdminClientCert()
        throws Exception {
    String dn = "dn=1";
    createOrgAndUserForWS(dn, false,
            OrganizationRoleType.TECHNOLOGY_PROVIDER);
    container.login(dn);
    PlatformUser user = runTX(new Callable<PlatformUser>() {
        @Override
        public PlatformUser call() throws Exception {
            return mgr.getCurrentUserIfPresent();
        }
    });
    Assert.assertNull("No valid user object expected", user);
    try {
        runTX(new Callable<PlatformUser>() {
            @Override
            public PlatformUser call() throws Exception {
                return mgr.getCurrentUser();
            }
        });
    } catch (EJBException e) {
        throw e.getCausedByException();
    }
}
项目:oscm    文件:ServiceProvisioningServiceBeanIT.java   
@Test(expected = SaaSSystemException.class)
public void testCreateMarketingProductImageTypeInvalid() throws Exception {
    VOTechnicalService tp = createTechnicalProduct(svcProv);
    VOServiceDetails product = new VOServiceDetails();
    product.setServiceId("test");
    VOImageResource imageResource = new VOImageResource();
    byte[] content = BaseAdmUmTest.getFileAsByteArray(
            ServiceProvisioningServiceBeanIT.class, "icon1.png");
    imageResource.setBuffer(content);
    imageResource.setContentType("image/png");
    imageResource.setImageType(ImageType.SHOP_LOGO_LEFT);
    try {
        container.login(supplierUserKey, ROLE_SERVICE_MANAGER);
        svcProv.createService(tp, product, imageResource);
    } catch (EJBException e) {
        throw e.getCausedByException();
    }
}
项目:oscm    文件:EventServiceBean.java   
/**
 * Tests whether this exception or any nested exception is a
 * {@link EntityExistsException}. Unfortunately {@link EJBException}
 * sometimes nests cause exception in {@link Throwable#getCause()},
 * sometimes in {@link EJBException#getCausedByException()}. Arrrrg.
 */
private boolean isEntityExistsException(final Throwable e) {
    if (e == null) {
        return false;
    }
    if (e instanceof PersistenceException) {
        return true;
    }
    if (e instanceof EJBException) {
        final EJBException ejbex = (EJBException) e;
        if (isEntityExistsException(ejbex.getCausedByException())) {
            return true;
        }
    }
    return isEntityExistsException(e.getCause());
}
项目:oscm    文件:OrganizationIT.java   
/**
 * <b>Testcase:</b> Modify an existing organization object <br>
 * <b>ExpectedResult:</b>
 * <ul>
 * <li>Modification is saved to the DB</li>
 * <li>History object created for the organization</li>
 * <li>usedPayment unchanged</li>
 * <li>No new history object for PaymentInfo</li>
 * </ul>
 * 
 * @throws Throwable
 */
@Test
public void testModifyOrganization() throws Throwable {
    try {
        runTX(new Callable<Void>() {
            public Void call() throws Exception {
                doTestModifyOrganizationPrepare();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            public Void call() throws Exception {
                doTestModifyOrganization();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            public Void call() throws Exception {
                doTestModifyOrganizationCheck();
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCause();
    }
}
项目:oscm    文件:ServiceProvisioningServiceBeanPermissionIT.java   
@Test
public void savePriceModelForCustomer_asBroker() throws Exception {
    // given
    container.login(1L, UserRoleType.BROKER_MANAGER.name());

    // when
    try {
        sps.savePriceModelForCustomer(new VOServiceDetails(),
                new VOPriceModel(), new VOOrganization());
        fail();
    } catch (EJBException e) {

        // then
        assertTrue(e.getCausedByException() instanceof EJBAccessException);
    }
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:XMLTestCase.java   
@Test
@RunAsClient
public void testRemoteXML() throws Exception {
    logger.info("starting remoting ejb client test");

    try {
        createInitialContext();
        String hostname = getLocalHost().getHostName().toLowerCase();
        final UserTransaction userTransaction = getUserTransaction(hostname);
        XMLRemote bean = lookup(XMLRemote.class, "bank");
        assertEquals(STATUS_NO_TRANSACTION, bean.transactionStatus());

        try {
            userTransaction.begin();
            bean.transactionStatus();
            fail("the transaction is not supported");
        } catch (EJBException | IllegalStateException e) {
            logger.info("the transaction is not supported");
        }
    } finally {
        closeContext();
    }
}
项目:oscm    文件:IdentityServiceBeanLdapWithDbIT.java   
@Test(expected = UnsupportedOperationException.class)
public void createUser_LDAPUsed() throws Exception {
    try {
        final VOUserDetails userToCreate = new VOUserDetails();
        userToCreate.setUserId("newUser");
        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                idMgmt.createUser(userToCreate, Collections.singletonList(
                        UserRoleType.ORGANIZATION_ADMIN), null);
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCausedByException();
    }
}
项目:oscm    文件:ProductToPaymentTypeIT.java   
@Test(expected = NonUniqueBusinessKeyException.class)
public void testAdd_Duplicate() throws Exception {
    try {
        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                doTestAdd();
                return null;
            }
        });

        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                doTestAdd();
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCausedByException();
    }
}
项目:jboss-eap7.1-playground    文件:SimpleWildFlyConfigClient.java   
public static void main(String[] args) throws NamingException {
    checkArgs(args);

    // One option is to use the java context, the INITIAL_CONTEXT_FACTORY is added by jndi.properties
    // the URI and credentials by wildfly-config.xml
    InitialContext ic = new InitialContext();

    Simple proxy = (Simple) ic.lookup("ejb:EAP71-PLAYGROUND-server/ejb/SimpleBean!" + Simple.class.getName());

    try {
        if(proxy.checkApplicationUser("user1")) {
            log.info("Expected 'user1'");
        } else {
            log.severe("Unexpected user, see server.log");
        }
    } catch (EJBException e) {
        throw e;
    }
}
项目:tap17-muggl-javaee    文件:RequestBean.java   
public List<String> locateVendorsByPartialName(String name) {

    List<String> names = new ArrayList<>();
    try {
        List vendors = em.createNamedQuery(
                "findVendorsByPartialName")
                .setParameter("name", name)
                .getResultList();
        for (Iterator iterator = vendors.iterator(); iterator.hasNext();) {
            Vendor vendor = (Vendor)iterator.next();
            names.add(vendor.getName());
        }
    } catch (Exception e) {
        throw new EJBException(e.getMessage());
    }
    return names;
}
项目:oscm    文件:ADMUMStartupTest.java   
@Before
public void setUp() {
    cfg = new ConfigurationServiceStub() {
        @Override
        public ConfigurationSetting getConfigurationSetting(
                ConfigurationKey key, String context) {
            if (throwExceptionWhenRetrievingSettings) {
                throw new EJBException();
            }
            if (key == ConfigurationKey.LOG_FILE_PATH) {
                return new ConfigurationSetting(
                        ConfigurationKey.LOG_FILE_PATH,
                        Configuration.GLOBAL_CONTEXT, ".");
            }
            return new ConfigurationSetting();
        }
    };
    testClass = new ADMUMStartup();

    testClass.cs = cfg;
    testClass.localizer = mock(LocalizerServiceLocal.class);
    testClass.prodSessionMgmt = mock(SessionServiceLocal.class);
    testClass.timerMgmt = mock(TimerServiceBean.class);
    testClass.searchService = mock(SearchServiceLocal.class);
}
项目:oscm    文件:OrganizationIT.java   
/**
 * <b>Testcase:</b> Delete an existing organization object <br>
 * <b>ExpectedResult:</b>
 * <ul>
 * <li>Organization marked as deleted in the DB</li>
 * <li>History object created for the deleted organization</li>
 * <li>PaymentInfo (usedPayment) marked as deleted in the DB</li>
 * <li>History object created for the deleted PaymentInfo</li>
 * </ul>
 * 
 * @throws Throwable
 */
@Test
public void testDeleteOrganization() throws Throwable {
    try {
        runTX(new Callable<Void>() {
            public Void call() throws Exception {
                doTestDeleteOrganizationPrepare();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            public Void call() throws Exception {
                doTestDeleteOrganization();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            public Void call() throws Exception {
                doTestDeleteOrganizationCheck();
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCause();
    }
}
项目:oscm-app    文件:APPTimerServiceBeanIT.java   
/**
 * Validates error handling on case of EJB exception during creation
 * (Bugzilla #9566)
 */
@Test
public void testHandleEJBErrorDuringCreation() throws Exception {
    // given
    createServiceInstance(ProvisioningStatus.WAITING_FOR_SYSTEM_CREATION);

    // Throw EJB exception when creation status is invoked
    EJBException e = new EJBException("ejb_error");
    when(controller.getInstanceStatus(matches("appInstanceId"),
            any(ProvisioningSettings.class))).thenThrow(e);

    // when
    handleTimer();

    // then
    verify(besDAOMock, times(1)).notifyAsyncSubscription(
            any(ServiceInstance.class), any(InstanceResult.class),
            eq(false), any(APPlatformException.class));
}
项目:tap17-muggl-javaee    文件:RequestBeanQueries.java   
public List<PlayerDetails> getPlayersByCity(String city) {
    logger.info("getPlayersByCity");
    List<Player> players = null;

    try {
        CriteriaQuery<Player> cq = cb.createQuery(Player.class);
        if (cq != null) {
            Root<Player> player = cq.from(Player.class);
            Join<Player, Team> team = player.join(Player_.team);

            // Get MetaModel from Root
            //EntityType<Player> Player_ = player.getModel();

            // set the where clause
            cq.where(cb.equal(team.get(Team_.city), city));
            cq.select(player).distinct(true);
            TypedQuery<Player> q = em.createQuery(cq);
            players = q.getResultList();
        }
        return copyPlayersToDetails(players);
    } catch (Exception ex) {
        throw new EJBException(ex);
    }
}
项目:oscm    文件:ServiceProvisioningServiceBeanCopyIT.java   
private void validateNoCategories(final VOServiceDetails copy)
        throws Exception {
    try {
        runTX(new Callable<Void>() {

            @Override
            public Void call() throws Exception {
                Product c = dataManager.getReference(Product.class,
                        copy.getKey());
                assertEquals(1, c.getCatalogEntries().size());
                CatalogEntry cCe = c.getCatalogEntries().get(0);
                assertTrue(cCe.getCategoryToCatalogEntry().isEmpty());
                assertNull(cCe.getMarketplace());
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCausedByException();
    }
}
项目:oscm    文件:MarketplaceIT.java   
/**
 * Tests the creation of a Marketplace object and compare the persisted
 * object with the original and the history.
 * 
 * @throws Throwable
 */
@Test
public void testAdd() 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();
    }
}
项目:oscm    文件:VatServiceBeanPermissionIT.java   
@Test
public void saveDefaultVat_asReseller() throws Exception {
    // given
    container.login(givenReseller().getKey(),
            UserRoleType.RESELLER_MANAGER.name());

    // when
    try {
        vatService.saveDefaultVat(new VOVatRate());
        fail("EJBException expected as operation must fail due to not allowed role!");
    } catch (EJBException e) {

        // then
        assertTrue(e.getCausedByException() instanceof EJBAccessException);
    }
}
项目:oscm    文件:ProductClassBridgeIT.java   
@Test
public void test3() throws Throwable {
    try {
        runTX(new Callable<Void>() {
            public Void call() throws Exception {
                Product product = createProductAndExpectedFields();
                expectedFields.clear();
                productKey = createAndPublishCustomerCopy(product).getKey();
                expectedFields.put(ProductClassBridge.MP_ID, "est");
                return null;
            }
        });
        runTX(new Callable<Void>() {
            public Void call() {
                verifyIndexedFieldsForProduct(productKey);
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCause();
    }
}
项目:oscm    文件:ServiceProvisioningServiceBean2IT.java   
@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();
    }
}
项目:oscm    文件:ExceptionHandler.java   
/**
 * Get the causing SaasApplicationException for the given Throwable or null
 * if the Throwable was not caused by an SaasApplicationException.
 * 
 * @param t
 *            the Throwable to be analyzed
 * @return the causing SaasApplicationException or null
 */
public static SaaSApplicationException getSaasApplicationException(
        Throwable t) {
    while (t != null && t != t.getCause()
            && !(t instanceof SaaSApplicationException)
            && !(t instanceof SaaSSystemException)) {
        if (t instanceof EJBException && t.getCause() instanceof Exception
                && (((EJBException) t).getCausedByException() != null)) {
            t = ((EJBException) t).getCausedByException();
        } else {
            t = t.getCause();
        }
    }
    if (t instanceof SaaSApplicationException) {
        return (SaaSApplicationException) t;
    }
    return null;
}
项目:oscm    文件:AccountServiceBeanPermissionIT.java   
@Test
public void updateCustomerDiscount_asBroker() throws Exception {
    // given
    container.login(givenBroker().getKey(),
            UserRoleType.BROKER_MANAGER.name());

    // when
    try {
        as.updateCustomerDiscount(new VOOrganization());
        fail();
    } catch (EJBException e) {

        // then
        assertTrue(e.getCausedByException() instanceof EJBAccessException);
    }
}
项目:oscm    文件:AccountServiceBeanPermissionIT.java   
@Test
public void getCustomerPaymentConfiguration_asBroker() throws Exception {
    // given
    container.login(givenBroker().getKey(),
            UserRoleType.BROKER_MANAGER.name());

    try {
        // when
        as.getCustomerPaymentConfiguration();
        fail();
    } catch (EJBException e) {

        // then
        assertTrue(e.getCausedByException() instanceof EJBAccessException);
    }
}
项目:oscm    文件:ADMUMStartup.java   
/**
 * Checks the currently existing configuration settings. If a mandatory
 * setting is not present, an exception will be logged. It also checks for
 * the setting of the node name.
 */
private void checkSettings() {
    ConfigurationKey[] keys = ConfigurationKey.values();
    for (ConfigurationKey key : keys) {
        if (key.isMandatory()) {
            try {
                cs.getConfigurationSetting(key,
                        Configuration.GLOBAL_CONTEXT);
            } catch (EJBException e) {
                // will always log to the application server log file
                logger.logError(Log4jLogger.SYSTEM_LOG, e,
                        LogMessageIdentifier.ERROR_MANDATORY_PROPERTY_NOT_SET,
                        key.getKeyName());
            }
        }
    }

    // check if the node name is configured
    String nodeName = cs.getNodeName();
    if (nodeName == null) {
        logger.logError(
                LogMessageIdentifier.ERROR_MANDATORY_SETTING_OF_NODE_NOT_SET);
    }
}
项目:oscm    文件:PricingServiceBeanContainerIT.java   
@Test
public void getPartnerRevenueSharesForMarketplace_invalidRole()
        throws Exception {

    // given
    container.login(mpOwnerUserKey, UserRoleType.TECHNOLOGY_MANAGER.name());

    // when
    try {
        pricingService.getPartnerRevenueSharesForMarketplace(MARKETPLACEID);
        fail();
    } catch (EJBException e) {

        // then
        assertTrue(e.getCausedByException() instanceof EJBAccessException);
    }
}
项目:oscm    文件:ExceptionHandler.java   
/**
 * Convert a EJBException into FacesMessage which is presented to the user.
 * 
 * @param ex
 *            the EJBException to be analyzed
 */
public static void execute(EJBException ex) {
    if (ex != null && ex.getCause() instanceof Exception
            && ex.getCausedByException() instanceof AccessException) {
        handleOrganizationAuthoritiesException();
    } else if (ex != null && isInvalidUserSession(ex)) {
        HttpServletRequest request = JSFUtils.getRequest();
        request.getSession().removeAttribute(Constants.SESS_ATTR_USER);
        request.getSession().invalidate();
        handleInvalidSession();
    } else if (ex != null && isConnectionException(ex)) {
        handleMissingConnect(BaseBean.ERROR_DATABASE_NOT_AVAILABLE);
    } else {
        throw new FacesException(ex);
    }
}
项目:oscm    文件:TimerServiceBean2Test.java   
@Test(expected = ValidationException.class)
public void initTimers_nextExpirationDateNegative()
        throws ValidationException {

    tss = new TimerServiceStub() {
        @Override
        public Timer createTimer(Date arg0, Serializable arg1)
                throws IllegalArgumentException, IllegalStateException,
                EJBException {
            initTimer((TimerType) arg1, arg0);
            getTimers().add(timer);
            return null;
        }
    };
    when(ctx.getTimerService()).thenReturn(tss);
    cfs.setConfigurationSetting(
            ConfigurationKey.TIMER_INTERVAL_ORGANIZATION,
            "9223372036854775807");

    tm.initTimers();
}
项目:oscm    文件:ServiceProvisioningServiceBeanCopyIT.java   
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();
    }
}
项目:oscm    文件:SubscriptionServiceBeanCustomerSubscriptionsIT.java   
@Test
public void getSubscriptionIdentifiers_NotAuthorized() throws Exception {
    // given
    container.login(brokerUserKey, ROLE_TECHNOLOGY_MANAGER);
    try {
        // when
        subscriptionSvc.getSubscriptionIdentifiers();
        fail();
    } catch (EJBException ex) {
        // then
        assertTrue(ex.getCause() instanceof EJBAccessException);
    }
}
项目:oscm    文件:TransactionInvocationHandlersTest.java   
@Test
public void testHANDLER_NOTX_Exception() throws Exception {
    final Exception root = new IOException();
    try {
        TransactionInvocationHandlers.HANDLER_NOTX.call(
                callableException(root), ctxStub);
        fail("Exception expected");
    } catch (EJBException ejbex) {
        assertSame(root, ejbex.getCause());
        assertSame(root, ejbex.getCausedByException());
    }
    assertEquals(Arrays.asList("call()"), stubCalls);
}
项目:oscm    文件:ProductReviewIT.java   
/**
 * <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();
    }
}
项目:oscm    文件:ProductIT.java   
/**
 * <b>Testcase:</b> Delete priceModel of an existing product object and add
 * a new PriceModel<br>
 * <b>ExpectedResult:</b>
 * <ul>
 * <li>Old PriceModel marked as deleted in the DB</li>
 * <li>History object created for the deleted object</li>
 * <li>New PriceModel stored in the DB</li>
 * <li>History object created for the new PriceModel</li>
 * </ul>
 * 
 * @throws Throwable
 */
@Test
public void testNewPriceModel() throws Throwable {
    try {
        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                doTestNewPriceModelPrepare();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                doTestNewPriceModel();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            @Override
            public Void call() {
                doTestNewPriceModelCheck();
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCause();
    }
}
项目:oscm    文件:SubscriptionIT.java   
/**
 * <b>Testcase:</b> Modify an existing Subscription object <br>
 * <b>ExpectedResult:</b>
 * <ul>
 * <li>Modification is saved to the DB</li>
 * <li>History object created for the subscription</li>
 * <li>No history object created for the priceModel (unchanged)</li>
 * <li>No new history object for UsageLicense (unchanged)</li>
 * </ul>
 * 
 * @throws Throwable
 */
@Test
public void testModifySubscription() throws Throwable {
    try {
        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                doTestModifySubPrepare();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                doTestModifySub();
                return null;
            }
        });
        runTX(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                doTestModifySubCheck();
                return null;
            }
        });
    } catch (EJBException e) {
        throw e.getCause();
    }
}
项目:oscm    文件:MarketplaceServiceBeanGetMarketplaceAndOrganizationIT.java   
@Test(expected = ObjectNotFoundException.class)
public void getMarketplacesForService_SvcNotFound() throws Exception {
    VOService svc = new VOService();
    svc.setServiceId("UNKNOWN_SVC_ID");
    try {
        container.login(supplier1Key, ROLE_SERVICE_MANAGER);
        marketplaceService.getMarketplacesForService(svc);
    } catch (EJBException e) {
        throw e.getCausedByException();
    }
}
项目:tap17-muggl-javaee    文件:RequestBean.java   
public List<CustomerOrder> getOrders() {
    try {
        return (List<CustomerOrder>) em.createNamedQuery("findAllOrders").getResultList();
    } catch (Exception e) {
        throw new EJBException(e.getMessage());
    }
}
项目:oscm    文件:MarketplaceServiceManagePartnerBeanRolesIT.java   
@Test
public void updateMarketplace_Admin() throws Exception {
    container.login(user.getKey(), ROLE_ORGANIZATION_ADMIN);
    try {
        service.updateMarketplace(null, null, null);
        fail();
    } catch (EJBException ex) {
        assertTrue(ex.getCause() instanceof EJBAccessException);
    }
}
项目:oscm    文件:PriceModelIT.java   
@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 {
            PriceModel pm = mgr.getReference(PriceModel.class, models
                    .get(0).getKey());
            mgr.remove(pm.getProduct());
            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();
    }
}
项目:oscm    文件:BillingServiceGetShareDataIT.java   
@Test(expected = org.oscm.internal.types.exception.IllegalArgumentException.class)
public void getRevenueShareData_NoToDate() throws Exception {
    // given
    container.login(brokerUser.getKey(), ROLE_SERVICE_MANAGER);

    // when
    try {
        bs.getRevenueShareData(Long.valueOf(PERIOD_START_MONTH1), null,
                BillingSharesResultType.BROKER);
    } catch (EJBException ex) {
        // then
        throw ex.getCausedByException();
    }
}
项目:oscm    文件:ServiceProvisioningPotentialCompatibleServicesIT.java   
@Test(expected = EJBAccessException.class)
public void getPotentialCompatibleServices_OrganizationAdmin()
        throws Exception {
    container.login(userKey, UserRoleType.ORGANIZATION_ADMIN.name());
    try {
        sps.getPotentialCompatibleServices(null);
    } catch (EJBException e) {
        throw e.getCausedByException();
    }
}
项目:oscm    文件:SessionServiceBeanIT.java   
@Test(expected = EJBException.class)
public void testDeletePlatformSession() throws Exception {
    String sessionid = "sessionId";
    testPlatformSession();
    sessionMgmt.deletePlatformSession(sessionid);

    sessionMgmtLocal.getPlatformSessionForSessionId(sessionid);
}