/** * {@inheritDoc} */ @Override protected Configuration getConfiguration() { return this.container.getConfiguration(); }
@Override public void run() { try { if (org.codehaus.cargo.container.State.STARTED == localContainer.getState() || org.codehaus.cargo.container.State.STARTING == localContainer.getState()) { localContainer.stop(); } } catch (Exception e) { throw new CargoException("Failed stopping the container.", e); } } });
/** * {@inheritDoc} */ @Override protected void executeLocalContainerAction() { this.localContainer.restart(); } }
/** * Sole constructor. * @param jrunContainer {@link LocalContainer} */ public JRun4xFilterChain(LocalContainer jrunContainer) { this.jrunContainer = (InstalledLocalContainer) jrunContainer; this.configuration = jrunContainer.getConfiguration(); this.xmlUtil = new XmlUtils(jrunContainer.getFileHandler()); this.init(); }
/** * {@inheritDoc} */ @Override public void startAndStop(URL warPingURL) { String testFileName = "cargo-test/test.file"; File testFile = new File(getLocalContainer().getConfiguration().getHome(), testFileName); assertFalse("File " + testFile + " already exists", testFile.exists()); FileConfig fileConfig = new FileConfig(); fileConfig.setFile(getTestData().getTestDataFileFor("simple-war")); fileConfig.setToFile(testFileName); getLocalContainer().getConfiguration().setConfigFileProperty(fileConfig); getLocalContainer().start(); PingUtils.assertPingTrue(warPingURL.getPath() + " not started", warPingURL, getLogger()); // CARGO-1195: DeployableFiles should be setup for ExistingLocalConfiguration assertTrue("File " + testFile + " was not configured", testFile.exists()); getLocalContainer().stop(); PingUtils.assertPingFalse(warPingURL.getPath() + " not stopped", warPingURL, getLogger()); }
start.setAutostart(daemonAutostartContainer); start.setContainer(installedLocalContainer); start.setDeployables(localContainer.getConfiguration().getDeployables()); start.setHandleId(daemonHandleId); if (getZipURLInstaller() != null) localContainer.start(); waitDeployableMonitor(true); localContainer.restart(); waitDeployableMonitor(true); localContainer.start(); waitDeployableMonitor(true); localContainer.stop(); waitDeployableMonitor(false); localContainer.getConfiguration().configure(localContainer);
getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/" + getPropertyValue(GeronimoPropertySet.GERONIMO_SERVLET_CONTAINER_ID) + "/config.xml", new File(configDir, "config.xml"), filterChain, "UTF-8"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/users.properties", new File(securityDir, "users.properties"), filterChain, "ISO-8859-1"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/groups.properties", new File(securityDir, "groups.properties"), filterChain, "ISO-8859-1"); String keystoresDir = getFileHandler().createDirectory(securityDir, "keystores"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/keystore", new File(keystoresDir, "geronimo-default")); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/server-log4j.properties", new File(logDir, "server-log4j.properties"), filterChain, "ISO-8859-1"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/client-log4j.properties", new File(logDir, "client-log4j.properties"), filterChain, "ISO-8859-1"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/deployer-log4j.properties", new File(logDir, "deployer-log4j.properties"), filterChain, "ISO-8859-1");
public String getDeployableDir(Deployable deployable) String jonasDeployableDir = getContainer().getConfiguration().getHome(); if (DeployableType.WAR.equals(deployable.getType())) throw new ContainerException("Container " + getContainer().getName() + " cannot deploy " + deployable.getType() + " deployables");
/** * {@inheritDoc} */ @Override public void doConfigure(LocalContainer container) throws Exception { try { setupConfigurationDir(); FilterChain filterChain = createJettyFilterChain(); String etcDir = getFileHandler().createDirectory(getHome(), "etc"); getResourceUtils().copyResource(RESOURCE_PATH + "cargocpc.war", new File(getHome(), "cargocpc.war")); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/webdefault.xml", new File(etcDir, "webdefault.xml"), filterChain, "UTF-8"); if (container.getOutput() != null) { activateLogging(container); } } catch (Exception e) { throw new ContainerException("Failed to create a " + container.getName() + " container configuration", e); } }
/** * Start, test and stop WAR. * @param warPingURL WAR ping URL. */ protected void startAndStop(URL warPingURL) { getLocalContainer().start(); PingUtils.assertPingTrue(warPingURL.getPath() + " not started", warPingURL, getLogger()); getLocalContainer().stop(); PingUtils.assertPingFalse(warPingURL.getPath() + " not stopped", warPingURL, getLogger()); } }
if (!getContainer().getCapability().supportsDeployableType(deployable.getType())) + " archives are not supported for deployment in [" + getContainer().getId() + "]. Got [" + deployable.getFile() + "]"); throw new ContainerException("Container " + getContainer().getName() + " cannot deploy expanded " + deployable.getType() + " deployables");
getLocalContainer().start(); assertEquals(State.STARTED, getContainer().getState()); getLocalContainer().restart(); assertEquals(State.STARTED, getContainer().getState()); getLocalContainer().stop(); assertEquals(State.STOPPED, getContainer().getState()); getLocalContainer().restart(); assertEquals(State.STARTED, getContainer().getState()); getLocalContainer().stop(); assertEquals(State.STOPPED, getContainer().getState());
if (!getContainer().getCapability().supportsDeployableType(deployable.getType())) throw new ContainerException(getContainer().getName() + " doesn't support [" + deployable.getType().getType().toUpperCase() + "] archives. Got [" + deployable.getFile() + "]");
/** * {@inheritDoc} */ @Override public void configure(LocalContainer container) { if (getPropertyValue(GeneralPropertySet.JAVA_HOME) == null) { setProperty(GeneralPropertySet.JAVA_HOME, System.getProperty("java.home")); } parsePropertiesForPendingConfiguration(); verify(); try { doConfigure(container); } catch (Exception e) { throw new ContainerException("Failed to create a " + container.getName() + " " + getType().getType() + " configuration", e); } configureFiles(getFilterChain(), container); }
/** * {@inheritDoc} */ @Override public void doExecute() throws MojoExecutionException { Container container = createContainer(); if (!container.getType().isLocal()) { throw new MojoExecutionException("Only local containers can be stopped"); } try { ((LocalContainer) container).stop(); waitDeployableMonitor(container, false); } catch (Exception ex) { throw new MojoExecutionException( "Cannot start container [" + container + "]", ex); } } }
/** * Start container with port offset. * @throws Exception If anything goes wrong. */ public void testStartWithPortOffset() throws Exception { int offsetValue = Integer.valueOf(OFFSET); int portWithOffset = getTestData().port + offsetValue; Deployable war = new DefaultDeployableFactory().createDeployable(getContainer().getId(), getTestData().getTestDataFileFor("simple-war"), DeployableType.WAR); getLocalContainer().getConfiguration().addDeployable(war); URL warPingURL = new URL("http://localhost:" + portWithOffset + "/simple-war/index.jsp"); getLocalContainer().start(); PingUtils.assertPingTrue(warPingURL.getPath() + " not started", warPingURL, getLogger()); getLocalContainer().stop(); PingUtils.assertPingFalse(warPingURL.getPath() + " not stopped", warPingURL, getLogger()); } }
start.setAutostart(daemonAutostartContainer); start.setContainer(installedLocalContainer); start.setDeployables(localContainer.getConfiguration().getDeployables()); start.setHandleId(daemonHandleId); if (getZipURLInstaller() != null) localContainer.start(); waitDeployableMonitor(true); localContainer.restart(); waitDeployableMonitor(true); localContainer.start(); waitDeployableMonitor(true); localContainer.stop(); waitDeployableMonitor(false); localContainer.getConfiguration().configure(localContainer);
getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/" + getPropertyValue(GeronimoPropertySet.GERONIMO_SERVLET_CONTAINER_ID) + "/config.xml", new File(configDir, "config.xml"), filterChain, "UTF-8"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/users.properties", new File(securityDir, "users.properties"), filterChain, "ISO-8859-1"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/groups.properties", new File(securityDir, "groups.properties"), filterChain, "ISO-8859-1"); String keystoresDir = getFileHandler().createDirectory(securityDir, "keystores"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/keystore", new File(keystoresDir, "geronimo-default")); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/server-log4j.properties", new File(logDir, "server-log4j.properties"), filterChain, "ISO-8859-1"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/client-log4j.properties", new File(logDir, "client-log4j.properties"), filterChain, "ISO-8859-1"); getResourceUtils().copyResource(RESOURCE_PATH + container.getId() + "/deployer-log4j.properties", new File(logDir, "deployer-log4j.properties"), filterChain, "ISO-8859-1");
public String getDeployableDir(Deployable deployable) String jonasDeployableDir = getContainer().getConfiguration().getHome(); if (DeployableType.WAR.equals(deployable.getType())) throw new ContainerException("Container " + getContainer().getName() + " cannot deploy " + deployable.getType() + " deployables");