Package org.rioproject.tools.webster

Examples of org.rioproject.tools.webster.Webster


*/
public class LoadConfigurationAsHttpResourceTest {

    @Test
    public void testLoadingConfigurationAsHttpResource() throws IOException, ConfigurationException {
        Webster webster = new Webster(0, System.getProperty("user.dir")+"/src/test/resources");
        System.setProperty("TEST_PORT", Integer.toString(webster.getPort()));
        OpStringParser opStringParser = new GroovyDSLOpStringParser();
        File file = new File("src/test/resources/opstring/simple_opstring_with_http_config.groovy");
        List<OpString> opStrings = opStringParser.parse(file,   // opstring
                                                        null,     // parent classloader
                                                        null,     // defaultGroups
View Full Code Here


                isArtifact = true;
            } catch(Exception e) {
                /**/
            }
            OperationalString toDeploy = null;
            Webster embeddedWebster = null;
            URL oarUrl = null;
            //String oarUrl = null;
            try {
                if(!isArtifact) {
                    try {
                        oarUrl = new URL(deployName);
                    } catch(MalformedURLException e) {
                        File oarFile = getDeploymentFile(deployName);
                        OAR oar = new OAR(oarFile);
                        embeddedWebster = new Webster(0, oarFile.getParentFile().getAbsolutePath());
                        toDeploy = oar.loadOperationalStrings()[0];
                        oarUrl = new URL("http://"+embeddedWebster.getAddress()+":"+embeddedWebster.getPort()+"/"+oarFile.getName());
                    }
                    System.out.println("===> "+oarUrl);
                }
            } catch (Exception e) {
                e.printStackTrace();
                return("Problem resolving ["+deployName+"], Exception : "+e.getLocalizedMessage());
            }

            try {
                DeployAdmin deployAdmin =
                    (DeployAdmin)CLI.getInstance().getServiceFinder().getPreparedAdmin(item.service);
                Boolean wait = (Boolean)CLI.getInstance().settings.get(CLI.DEPLOY_BLOCK);

                if(deployOptions.getDeployTimeout()>0 && wait) {
                    ServiceProvisionNotification spn = CLI.getInstance().provisionNotifier;
                    String label = "Artifact";
                    if(isArtifact) {
                        deployAdmin.deploy(deployName, spn.getServiceProvisionListener());
                    } else {
                        label = "OAR";
                        try{
                            //deployAdmin.deploy(toDeploy, spn.getServiceProvisionListener());
                            deployAdmin.deploy(oarUrl, spn.getServiceProvisionListener());
                        } finally {
                            if(embeddedWebster!=null)
                                embeddedWebster.terminate();
                        }
                    }
                    long t0 = System.currentTimeMillis();
                    out.println("Deploying "+label+" ["+deployName+"] ...");
                    spn.notify(1, deployOptions.getDeployTimeout());
View Full Code Here

                                     File.separator+
                                     "lib-dl";

                String systemRoots = deployDir+";"+rioLibDir+";"+rioLibDLDir;
                String realRoots = (roots == null?systemRoots:roots);
                instance.webster = new Webster(port,
                                      realRoots,
                                      instance.hostAddress);
            } catch(Exception e) {
                e.printStackTrace();
                out.println("Problem creating HTTP server, "+
View Full Code Here

                out.println("Login time: "+new Date(startTime).toString());
                out.println("Time logged in: "+
                            TimeUtil.format(currentTime-startTime));
                if(instance.getRioLog()!=null)
                    out.println("Log file : "+instance.getRioLog().getAbsolutePath());
                Webster web = instance.getWebster();
                if(web==null) {
                    out.println("http: No HTTP server started");
                } else {

                    out.println("http: Address : http://"+web.getAddress()+":"+
                                web.getPort()+"\n"+
                                "       Root(s) : "+web.getRoots());
                }

                ReggieStat[] rStats =
                    instance.getServiceFinder().getReggieStats(ReggieStat.DISCOVERED);
                out.println("Lookup Service Discovery Statistics");
View Full Code Here

TOP

Related Classes of org.rioproject.tools.webster.Webster

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.