Examples of TestContainerException


Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

            LOGGER.info("Starting the Grizzly2 Web Container...");

            try {
                httpServer.start();
            } catch (IOException ex) {
                throw new TestContainerException(ex);
            }

        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

            try {
                httpServer = GrizzlyServerFactory.createHttpServer(baseUri, (HttpHandler) null);
                context.deploy(httpServer);
            } catch(IOException ioe) {
                throw new TestContainerException(ioe);
            }
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

                fin.close();
                fout.close();
            } catch (IOException ioeX) {
                LOGGER.info("Encountered IOException [" + ioeX.getMessage() + "] trying to copyFile(InputStream,OutputStream) for [" + warArchive.toString() + "]");
                throw new TestContainerException(ioeX);
            }
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

                    String deployedApp = deployer.deploy(warArchive.toURI());
                    LOGGER.info("Deployed [" + deployedApp + "] to EmbeddedGlassFish instance [" + deployer.toString() + "] with context-root set to [" + this.appDescriptor.getContextPath() + "]");
                }
            } catch (org.glassfish.embeddable.GlassFishException ex) {
                LOGGER.info("Caught GlassFishException ["+ex.getMessage()+ "] trying to start the embedded server instance");
                throw new TestContainerException(ex);
            } catch (java.io.IOException ioe) {
                LOGGER.info("Caught IOException ["+ioe.getMessage()+ "] trying to start the embedded server instance");
                throw new TestContainerException(ioe);
            }
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

                deployer = glassfish.getDeployer();
                // Return names of all the deployed applications.               
                deployedApps = deployer.getDeployedApplications();
              
            } catch (GlassFishException glassFishException) {
                throw new TestContainerException(glassFishException);
            }

            //  undeploy each app in for-each loop
            for (String deployedApp : deployedApps) {
                try {
                    //see http://java.net/jira/browse/EMBEDDED_GLASSFISH-123                   
                    deployer.undeploy(deployedApp, "--droptables", "true");                   
                } catch (GlassFishException glassFishException) {
                    throw new TestContainerException(glassFishException);
                }
                LOGGER.info("Undeployed = " + deployedApp);
            }
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

                 // this will avoid "already bootstrapped" errors seen when running multiple tests
                 // in same VM
                 gfr.shutdown();                              

            } catch (GlassFishException ex) {
                throw new TestContainerException(ex);
            }
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

            if (gfr == null) {
                try {
                    LOGGER.info("Create instantiated GlassFishRuntime");
                    gfr = GlassFishRuntime.bootstrap();
                } catch (GlassFishException ex) {
                    throw new TestContainerException(ex);
                }
            } else {
                LOGGER.info("Re-use Already instantiated GlassFishRuntime");
                // try doing gfr.shutdown() if you were to
                // bootstrap GlassFishRuntime again.
                // Shutdown GlassFish.
                try {
                    gfr.shutdown();
                    // can comment out to see if this fixes 'already bootstrapped' error
                    // but never reaches here on 2nd test
                    gfr = GlassFishRuntime.bootstrap();
                } catch (GlassFishException shutdownex) {
                    throw new TestContainerException(shutdownex);
                }
            }

            if (glassfish == null) {
                try {                
                    GlassFishProperties gfProperties = new GlassFishProperties();
                    gfProperties.setPort("http-listener", getBaseUri().getPort());

                    glassfish = gfr.newGlassFish(gfProperties);
                    // use glassfish
                } catch (GlassFishException ngfex) {
                    throw new TestContainerException(ngfex);
                }
            } else {
                LOGGER.info("Dispose Already instantiated GlassFish");
                try {
                    // dispose it.
                    glassfish.dispose();
                } catch (GlassFishException disposeex) {
                    throw new TestContainerException(disposeex);
                }
                LOGGER.info("Create another instantiated GlassFish");
                try {
                  glassfish = gfr.newGlassFish();
                } catch (GlassFishException ngfex2) {
                    throw new TestContainerException(ngfex2);
                }               
            }
          
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

                    OutputStream outputStream = new FileOutputStream(webXml);
                    WebXmlGenerator webXmlGenerator = new WebXmlGenerator(appDescriptor);
                    try {
                        webXmlGenerator.marshalData(outputStream);
                    } catch (JAXBException ex) {
                        throw new TestContainerException(ex);
                    }
                    outputStream.close();
                } catch (FileNotFoundException ex) {
                    throw new TestContainerException(ex);
                } catch (IOException ex) {
                    throw new TestContainerException(ex);
                }
                return true;
            }
            return false;
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

                     // required if exist already //The name for this metadata will be obtained by doing metadata.getName()
                    try {
                        warArchive.addMetadata(new File(SRC_WEBAPP_PATH+ "/"  + WEB_INF_PATH + "/", WEB_XML));
                    } catch (java.io.IOException ioe) {
                        LOGGER.info("Encountered IOException [" + ioe.getMessage() + "] trying to addMetadata [" + SRC_WEBAPP_PATH+ "/"  + WEB_INF_PATH + "/" + WEB_XML + "]");
                        throw new TestContainerException(ioe);
                    }

                    //The name for this metadata will be obtained by doing metadata.getName()
                    //scatteredArchiveBuilder.addMetadata(new File(SRC_WEBAPP_PATH + "/"  + WEB_INF_PATH + "/" + SUN_WEB_XML));
                    // resources/sun-web.xml is my WEB-INF/sun-web.xml
                    //archive.addMetadata(new File("resources", "sun-web.xml"));
                    try {
                        warArchive.addMetadata(new File(SRC_WEBAPP_PATH+ "/"  + WEB_INF_PATH + "/", SUN_WEB_XML));
                    } catch (java.io.IOException ioe) {
                        LOGGER.info("Encountered IOException [" + ioe.getMessage() + "] trying to addMetadata [" + SUN_WEB_XML + "]");
                        throw new TestContainerException(ioe);
                    }
                    // target/classes directory contains my complied servlets
                    //archive.addClassPath(new File("target", "classes"));
                    try {
                        warArchive.addClassPath(new File(TARGET_PATH, CLASSES_PATH));
                    } catch (java.io.IOException ioe) {
                        LOGGER.info("Encountered IOException [" + ioe.getMessage() + "] trying to addClassPath [" + TARGET_PATH +"/"+ CLASSES_PATH+ "]");
                        throw new TestContainerException(ioe);
                    }
                    // resources/MyLogFactory is my META-INF/services/org.apache.commons.logging.LogFactory
                    //archive.addMetadata(new File("resources", "MyLogFactory"),
                    //"META-INF/services/org.apache.commons.logging.LogFactory");
                    LOGGER.info("#1 inside method createArchive ==> webXmlGeneratedOnTheFly ==> just created scatteredArchive [" + SRC_WEBAPP_PATH + "] using WEB-INF/web.xml from [" + warArchive.toString() + "]");
                    System.out.println("jsb, #1 inside method createArchive ==> webXmlGeneratedOnTheFly ==> just created scatteredArchive [" + SRC_WEBAPP_PATH + "] using WEB-INF/web.xml from [" + warArchive.toString() + "]");
                } catch (Exception ex) {
                    throw new TestContainerException(ex);
                }
            } else {
                try {                 
                    LOGGER.info("#2 inside method createArchive ==> webXmlGeneratedOnTheFly ==> Creating scatteredArchive [" + TARGET_WEBAPP_PATH + "]");
                    //use global variable
                    //warArchive = new ScatteredArchive(baseUri.getRawPath()+File.separator+TARGET_WEBAPP_PATH+File.separator+"myWarArchive", ScatteredArchive.Type.WAR);
                    warArchive = new ScatteredArchive(baseUri.getRawPath(), ScatteredArchive.Type.WAR);

                    //The name for this metadata will be obtained by doing metadata.getName()
                    try {
                        warArchive.addMetadata(new File(TARGET_WEBAPP_PATH+ "/"  + WEB_INF_PATH + "/", WEB_XML));
                    } catch (java.io.IOException ioe) {
                        LOGGER.info("Encountered IOException [" + ioe.getMessage() + "] trying to addMetadata [" + TARGET_WEBAPP_PATH+ "/"  + WEB_INF_PATH + "/" + WEB_XML + "]");
                        throw new TestContainerException(ioe);
                    }

                    // do i need to add sun-web.xml to scatteredArchive via addMetaData to set context-root correctly
                    //scatteredArchiveBuilder.addMetadata(new File(TARGET_WEBAPP_PATH + "/"  + WEB_INF_PATH + "/" + SUN_WEB_XML));
                    try {
                        warArchive.addClassPath(new File(TARGET_PATH, CLASSES_PATH));
                    } catch (java.io.IOException ioe) {
                        LOGGER.info("Encountered IOException [" + ioe.getMessage() + "] trying to addClassPath [" + TARGET_PATH +"/"+ CLASSES_PATH+ "]");
                        throw new TestContainerException(ioe);
                    }

                    LOGGER.info("#2 inside method createArchive ==> webXmlGeneratedOnTheFly ==> just created scatteredArchive [" + TARGET_WEBAPP_PATH + "] using WEB-INF/web.xml from [" + warArchive.toString() + "]");
                } catch (Exception ex) {
                    throw new TestContainerException(ex);
                }
            }           
        }
View Full Code Here

Examples of com.sun.jersey.test.framework.spi.container.TestContainerException

            LOGGER.info("Starting the Grizzly Web Container...");
           
            try {
                webServer.start();               
            } catch (IOException ex) {
                throw new TestContainerException(ex);
            }
            
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.