Package org.ow2.easybeans.tests.common.ejbs.entity.ebstore

Examples of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore


            resolve();
        }

        try {
            Thread.currentThread().setContextClassLoader(this.classLoader);
            Enhancer enhancer = new Enhancer(this.classLoader, this.deployment.getEjbJarArchiveMetadata(), this.enhancerMap);

            long tStartEnhancing = System.currentTimeMillis();
            try {
                enhancer.enhance();
            } catch (EnhancerException ee) {
                throw new EZBContainerException("Cannot run enhancer on archive '" + getName() + "'.", ee);
            } catch (RuntimeException e) {
                // Catch Exception as some exceptions can be runtime exception
                throw new EZBContainerException("Cannot run enhancer on archive '" + getName() + "'.", e);
View Full Code Here


        }

        // Needs to keep annotation for intercepted method
        if (this.classAnnotationMetadata.isBean()) {
            if (isInterceptedMethod(jMethod) || isInterceptorMethod(jMethod)) {
                MethodAdapterWithAnnotationRecorder methodAdapter = new MethodAdapterWithAnnotationRecorder(super.visitMethod(
                        newAccess, newName, desc, signature, exceptions));
                // keep annotations
                this.annotationsOfMethod.put(name + desc, methodAdapter.getAnnotationRecorders());
                this.parametersAnnotationsOfMethod.put(name + desc, methodAdapter.getParameterAnnotationRecorders());

                return methodAdapter;
            }
        }
        // Else only call super method
View Full Code Here

        // Get Deployable
        IDeployable<?> deployable = null;
        try {
            deployable = DeployableHelper.getDeployable(this.archive);
        } catch (DeployableHelperException e) {
            throw new ArchiveInjectionException("Unable to get a deployable on archive '" + this.archive + "'.", e);
        }

        // Client Archive ?
        if (CARDeployable.class.isInstance(deployable)) {
            // Create metadata
            ICarDeployableMetadata carDeployableMetadata = null;
            try {
                carDeployableMetadata = new CarDeployableMetadataFactory().createDeployableMetadata(CARDeployable.class
                        .cast(deployable), classLoader);
            } catch (DeployableMetadataException e) {
                throw new ArchiveInjectionException("Unable to get metadata on archive '" + this.archive + "'.", e);
            }

            // Use only common part
            this.metadataCollection = carDeployableMetadata.getCarClassMetadataCollection();
        } else {
View Full Code Here

        for (ICommonMethodMetadata<?, ?, ?> postConstructMethodMetadata : postConstructMethods) {
            Method postConstructMethod = null;
            try {
                postConstructMethod = clazz.getDeclaredMethod(postConstructMethodMetadata.getJMethod().getName());
            } catch (NoSuchMethodException e) {
                throw new ArchiveInjectionException("Cannot invoke postconstruct method", e);
            }

            boolean accessible = postConstructMethod.isAccessible();
            try {
                postConstructMethod.setAccessible(true);
                postConstructMethod.invoke(instance);
            } catch (IllegalAccessException e) {
                throw new ArchiveInjectionException("Cannot invoke postconstruct method", e);
            } catch (InvocationTargetException e) {
                throw new ArchiveInjectionException("Cannot invoke postconstruct method", e);
            } finally {
                postConstructMethod.setAccessible(accessible);
            }
        }
View Full Code Here

            // OK, now that JNDI name is here, get value
            try {
                value = new InitialContext().lookup(jndiName);
            } catch (NamingException e) {
                throw new ArchiveInjectionException("Cannot get object with JNDI Name '" + jndiName + "' for ejb '" + ejb
                        + "'.", e);
            }
        }

        // Set value
View Full Code Here

        // Create classloader with these URLs
        URL[] arrayURLs = urls.toArray(new URL[urls.size()]);

        // Child of the EAR classloader with RARs
        ClassLoader ejbClassLoader = new EasyBeansClassLoader(arrayURLs, earClassLoader);

        // Get Persistence unit manager
        PersistenceUnitManager persistenceUnitManager = getPersistenceUnitManager(earDeployable, ejbClassLoader);

        // Get Extra libraries
View Full Code Here

            if (this.warService == null) {
                logger.warn("There are WAR files in the EAR ''{0}'' but the 'web' service is not available", earDeployable);
            } else {

                // Build context for sending parameters
                Context ctx = new ContextImpl(earURL.toExternalForm());
                try {
                    ctx.rebind("earURL", earURL);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the EAR URL parameter '" + earURL + "'", e);
                }
                // Get URLS of the wars and context-root
                List<URL> urls = new LinkedList<URL>();
                List<String> ctxRoots = new LinkedList<String>();
                for (WARDeployable warDeployable : wars) {

                    // URL
                    URL url = null;
                    try {
                        url = warDeployable.getArchive().getURL();
                    } catch (ArchiveException e) {
                        throw new DeployerException("Cannot get the URL for the archive '" + warDeployable.getArchive() + "'",
                                e);
                    }
                    urls.add(url);

                    // Context-root
                    ctxRoots.add(warDeployable.getContextRoot());

                }
                try {
                    ctx.rebind("urls", urls.toArray(new URL[urls.size()]));
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the urls parameter '" + urls + "'", e);
                }

                // Bind the parent classloader of the web application
                try {
                    ctx.rebind("parentClassLoader", parentClassLoader);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the parentClassLoader parameter '" + parentClassLoader + "'", e);
                }

                // Bind the earClassLoader of the web application
                try {
                    ctx.rebind("earClassLoader", earClassLoader);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the earClassLoader parameter '" + earClassLoader + "'", e);
                }

                // No alt-dd yet, give an empty array
                try {
                    ctx.rebind("altDDs", new URL[urls.size()]);
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the altDDs parameter.'", e);
                }

                // Build context roots
                try {
                    ctx.rebind("contextRoots", ctxRoots.toArray(new String[ctxRoots.size()]));
                } catch (NamingException e) {
                    throw new DeployerException("Cannot add the contextRoots parameter '" + urls + "'", e);
                }

                try {
View Full Code Here

     * @output the method execution without error.
     */
    @Test
    public void createNewEntity() {
        slsbEntityManagerTester.createEBStoreNew(PRIMARY_KEY, ENTITY_NAME);
        EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY);
        assertNotNull(ebstore, "The entity was not inserted in the database");
    }
View Full Code Here

     * @output the method execution without error.
     */
    @Test
    public void createRemoved() {
        slsbEntityManagerTester.createEBStoreRemoved(PRIMARY_KEY, ENTITY_NAME);
        EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY);
        assertNotNull(ebstore, "The entity was not re-inserted in the database");
    }
View Full Code Here

     * @output the method execution without error.
     */
    @Test
    public void createManaged() {
        slsbEntityManagerTester.createEBStoreManaged(PRIMARY_KEY, ENTITY_NAME);
        EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY);
        assertNotNull(ebstore, "The persist operation was not ignored.");
    }
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.tests.common.ejbs.entity.ebstore.EBStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.