/** * Creates a new instance of a port listening wait. * * @param port the port to attempt to connect to. * @return a new instance. */ public static PortListeningWait portListening(int port) { return new PortListeningWait(port); }
@Override public final T build() { checkState(deployable.getType() == DeployableType.WAR || deployable.getType() == DeployableType.DIR, "Can only deploy directories or WARs"); String sourcePath = deployable.getPath().getAbsolutePath(); LOG.debug("Deploying: [{}]: [{}]", deployable.getType(), sourcePath); getSpecBuilder().property("context", deployContext); getSpecBuilder().port(PortMappingSpec.random(defaultPort())).waitFor(PortListeningWait.portListening(defaultPort())) .waitFor(LogCheckWait.logMessage(getStartupLogText())).waitFor(ContextPathStatusWait.contextStatus(getDeployContext(), defaultPort(), 200)); copy(sourcePath, getContainerAppPath(), deployFileName + ".war"); if (!servletVariables.isEmpty()) { env(javaOpts(), new ServletVariableProvider(servletVariables)); } return buildInstance(getSpecBuilder()); }