org.codehaus.cargo.container.deployable.WAR.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.codehaus.cargo.container.deployable.WAR.<init>()方法的一些代码示例,展示了WAR.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WAR.<init>()方法的具体详情如下:
包路径:org.codehaus.cargo.container.deployable.WAR
类名称:WAR
方法名:<init>

WAR.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/geode

/**
 * Deploys the {@link #warFile} to the cargo container ({@link #container}).
 */
public void deployWar() {
 // Get the cargo war from the war file
 WAR war = new WAR(warFile.getAbsolutePath());
 // Set context access to nothing
 war.setContext("");
 // Deploy the war the container's configuration
 getConfiguration().addDeployable(war);
 logger.info("Deployed WAR file at {}", war.getFile());
}

代码示例来源:origin: stackoverflow.com

// (1) Optional step to install the container from a URL pointing to its distribution
Installer installer = new ZipURLInstaller(new URL("http://www.apache.org/dist/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.zip"));
installer.install();

// (2) Create the Cargo Container instance wrapping our physical container
LocalConfiguration configuration = (LocalConfiguration) new DefaultConfigurationFactory()
    .createConfiguration("tomcat6x"), ContainerType.INSTALLED, ConfigurationType.STANDALONE);
container = (InstalledLocalContainer) new DefaultContainerFactory()
    .createContainer("tomcat6x", ContainerType.INSTALLED, configuration);
container.setHome(installer.getHome());

// (3) Statically deploy some WAR (optional)
WAR deployable = new WAR("./webapp-testing-webapp/target/webapp-testing-webapp-1.0.war");
deployable.setContext("ROOT");
configuration.addDeployable(deployable);

// (4) Start the container
container.start();

代码示例来源:origin: org.jvnet.hudson.plugins/deploy

/**
 * Creates a Deployable object from the given file object.
 * @param deployableFile The deployable file to create the Deployable from.
 * @return A Deployable object.
 */
protected Deployable createDeployable(File deployableFile) {
  return new WAR(deployableFile.getAbsolutePath());
}

代码示例来源:origin: org.jenkins-ci.plugins/deploy

/**
 * Creates a Deployable object WAR from the given file object.
 *
 * @param deployableFile The deployable file to create the Deployable from.
 * @return A Deployable object.
 */
protected WAR createWAR(File deployableFile) {
  return new WAR(deployableFile.getAbsolutePath());
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-glassfish

/**
 * {@inheritDoc}
 */
@Override
protected void doConfigure(LocalContainer container) throws Exception
{
  // schedule cargocpc for deployment
  String cpcWar = this.getFileHandler().append(this.getHome(), "cargocpc.war");
  this.getResourceUtils().copyResource(RESOURCE_PATH + "cargocpc.war", new File(cpcWar));
  this.getDeployables().add(new WAR(cpcWar));
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * {@inheritDoc}
 */
@Override
protected void doConfigure(LocalContainer container) throws Exception
{
  // schedule cargocpc for deployment
  String cpcWar = this.getFileHandler().append(this.getHome(), "cargocpc.war");
  this.getResourceUtils().copyResource(RESOURCE_PATH + "cargocpc.war", new File(cpcWar));
  this.getDeployables().add(new WAR(cpcWar));
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test equality between WAR deployables.
 */
public void testWARTypeEquality()
{
  WAR war1 = new WAR("/some/path/to/file.war");
  WAR war2 = new WAR("/otherfile.war");
  assertEquals(war1.getType(), war2.getType());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test name when WAR has no extension.
 */
public void testGetNameWhenWarHasNoExtension()
{
  WAR war = new WAR("/some/path/to/war/test");
  assertEquals("test", war.getName());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test name when WAR has an extension.
 */
public void testGetNameWhenWarHasExtension()
{
  WAR war = new WAR("c:/some/path/to/war/test.war");
  assertEquals("test", war.getName());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test context when WAR has an extension.
 */
public void testGetContextWhenWarHasExtension()
{
  WAR war = new WAR("c:/some/path/to/war/test.war");
  assertEquals("test", war.getContext());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test context when WAR has no extension.
 */
public void testGetContextWhenWarHasNoExtension()
{
  WAR war = new WAR("/some/path/to/war/test");
  assertEquals("test", war.getContext());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test WAR context overriden with a leading slash.
 */
public void testGetContextWhenOverrideAndLeadingSlash()
{
  WAR war = new WAR("c:/some/path/to/war/test.war");
  war.setContext("/");
  assertEquals("", war.getContext());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test WAR context overriden with a slash in the middhe.
 */
public void testGetContextWhenOverrideAndMiddleSlash()
{
  WAR war = new WAR("c:/some/path/to/war/test.war");
  war.setContext("/a/b");
  assertEquals("a/b", war.getContext());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
   * Test name when WAR context is overriden.
   */
  public void testGetNameWhenOverride()
  {
    WAR war = new WAR("c:/some/path/to/war/test.war");
    war.setContext("context");
    assertEquals("context", war.getName());
  }
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test overriden WAR context.
 */
public void testGetContextWhenOverride()
{
  WAR war = new WAR("c:/some/path/to/war/test.war");
  war.setContext("context");
  assertEquals("context", war.getContext());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test logger when getting WAR context.
 */
public void testLoggerWhenCallingGetContext()
{
  MockLogger logger = new MockLogger();
  WAR war = new WAR("c:/test.war");
  war.setLogger(logger);
  // Calling getContext just to trigger the log
  war.getContext();
  assertEquals(1, logger.severities.size());
  assertEquals("debug", logger.severities.get(0));
  assertEquals("Parsed web context = [test]", logger.messages.get(0));
  assertEquals("org.codehaus.cargo.container.deployable.WAR", logger.categories.get(0));
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test if the <code>deploy</code> method can be called.
 */
public void testDeployMethodWithDeployableMonitorParameterCanBeCalled()
{
  TestableAbstractRemoteDeployer deployer = new TestableAbstractRemoteDeployer(
    createContainer());
  deployer.deploy(new WAR("some/file"), new DeployableMonitorStub("some/file"));
}

代码示例来源:origin: codehaus-cargo/cargo

/**
   * Test difference between WAR and EAR deployables.
   */
  public void testWARAndEARDifference()
  {
    WAR war = new WAR("/some/path/to/file.war");
    EAR ear = new EAR("/file.ear");
    assertNotSame(war.getType(), ear.getType());
    assertTrue(war.getType() != ear.getType());
  }
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test deployment of a WAR in its default context.
 * @throws Exception If anything goes wrong.
 */
public void testDeployWhenWarWithDefaultContext() throws Exception
{
  WAR war = new WAR("ram:///some/warfile.war");
  this.fsManager.resolveFile(war.getFile()).createFile();
  AbstractCopyingInstalledLocalDeployer deployer = new TestableCopyingDeployer(
    createContainer(createContainerCapability(DeployableType.WAR), null));
  assertFalse(this.fsManager.resolveFile("ram:///webapps/warfile.war").exists());
  deployer.deploy(war);
  assertTrue(this.fsManager.resolveFile("ram:///webapps/warfile.war").exists());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Test deployment of a WAR in a custom context.
 * @throws Exception If anything goes wrong.
 */
public void testDeployWhenWarWithCustomContext() throws Exception
{
  WAR war = new WAR("ram:///some/warfile.war");
  this.fsManager.resolveFile("ram:///some/warfile.war").createFile();
  war.setContext("context");
  AbstractCopyingInstalledLocalDeployer deployer = new TestableCopyingDeployer(
    createContainer(createContainerCapability(DeployableType.WAR), null));
  assertFalse(this.fsManager.resolveFile("ram:///webapps/context.war").exists());
  deployer.deploy(war);
  assertTrue(this.fsManager.resolveFile("ram:///webapps/context.war").exists());
}

相关文章