org.codehaus.cargo.container.installer.ZipURLInstaller类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(84)

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

ZipURLInstaller介绍

[英]Installs a zipped container file from a URL to a location on your local disk.
[中]将压缩容器文件从URL安装到本地磁盘上的某个位置。

代码示例

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

new ZipURLInstaller(url, TMP_DIR + "/downloads", installDir);
installer.install();

代码示例来源:origin: com.atlassian.cargo-test-runner/cargo-test-runner

/**
 * Use the home dir if specified by the user or download the container distribution and
 * installs it if an install URL has been specified. Also supports container not requiring a
 * home dir (embedded containers).
 * @param installURL
 * @param installDir
 */
private void setUpHome(URL installURL, File installDir) {
  if (installURL != null) {
    ZipURLInstaller installer = new ZipURLInstaller(installURL, null, installDir.getAbsolutePath());
    final SimpleLogger logger = new SimpleLogger();
    logger.setLevel(LogLevel.INFO);
    installer.setLogger(logger);
    installer.install();
    this.containerHome = new File(installer.getHome());
  }
}

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

extractDirectory = extractDirectoryFile.getPath();
ZipURLInstaller installer = new ZipURLInstaller(homeURL, home.getParent(),
  extractDirectory);
if (getLog() != null)
  installer.setLogger(container.getLogger());
  if (!installer.isAlreadyDownloaded())
    installer.download();
  installer.install();
  tmpHome = installer.getHome();
this.installerZipFile = installer.getDownloadFile();
  installer.setLogger(container.getLogger());
  if (!installer.isAlreadyDownloaded())
    installer.download();
  installer.install();
  tmpHome = installer.getHome();
this.installerZipFile = installer.getDownloadFile();

代码示例来源:origin: com.atlassian.sdk/ap3-api

public void runContainerAndWait(ProductContext ctx, String baseUrl, Path configDir, Path warFile, Map<String, String> sysProps, Map<String, String> props) throws IOException
  ZipURLInstaller installer = new ZipURLInstaller(new URL("http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip"));
  installer.setExtractDir(ctx.getAppDir().toAbsolutePath().toString());
  installer.install();
  container.setHome(installer.getHome());
  container.setSystemProperties(sysProps);

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

if (!isAlreadyExtracted())
  getLogger().debug("Container [" + getSourceFileName() + "] is not yet installed.",
    this.getClass().getName());
  if (!isAlreadyDownloaded())
    getLogger().debug("Container [" + getSourceFileName() + "] is not yet downloaded.",
      this.getClass().getName());
    download();
    getLogger().debug("Container [" + getSourceFileName()
      + "] is downloaded, now unpacking.", this.getClass().getName());
    unpack();
    getLogger().debug("Container [" + getSourceFileName() + "] is broken.",
      this.getClass().getName());
    File sourceFile = new File(getDownloadDir(), getSourceFileName());
    sourceFile.delete();
    download();
    try
      unpack();
        "Failed to unpack [" + getSourceFileName() + "]", ee);

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

/**
 * Set up a home dir (possibly using a ZipURLInstaller).
 */
protected void setupHome()
{
  if (getHome() != null)
  {
    ((InstalledLocalContainer) getContainer()).setHome(getHome());
  }
  else if (getZipURLInstaller() != null)
  {
    ZipURLInstaller installer = getZipURLInstaller().createInstaller();
    installer.setLogger(getContainer().getLogger());
    installer.install();
    ((InstalledLocalContainer) getContainer()).setHome(installer.getHome());
  }
}

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

/**
   * @return a new instance of {@link ZipURLInstaller} configured using the attributes specified
   * by the user
   */
  public ZipURLInstaller createInstaller()
  {
    ZipURLInstaller installer = new ZipURLInstaller(getInstallURL(), getDownloadDir(),
      getExtractDir());
    if (getProxy() != null)
    {
      installer.setProxy(getProxy());
    }
    return installer;
  }
}

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

installer.setLogger(getContainer().getLogger());
if (!installer.isAlreadyDownloaded())
  installer.download();
  zipURLInstallerElement.createInstaller().getDownloadFile());

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

this.installer.setAntTaskFactory(
  new AntTaskFactory()
Proxy proxy = new Proxy();
proxy.setHost("proxyhost");
this.installer.setProxy(proxy);
this.installer.download();

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

/**
 * Test {@link ZipURLInstaller#getHome()} when container not installed yet.
 * @throws Exception If anything goes wrong.
 */
public void testGetHomeWhenContainerNotInstalled() throws Exception
{
  this.installer.setExtractDir("ram:///tmp");
  try
  {
    this.installer.getHome();
    fail("Should have thrown a container exception here");
  }
  catch (ContainerException expected)
  {
    assertEquals("Failed to get container installation home as the container has not yet "
      + "been installed. Please call install() first.", expected.getMessage());
  }
}

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

/**
 * Creates the test ZIP URL installer and its fils system manager. {@inheritDoc}
 * @throws Exception If anything goes wrong.
 */
@Override
protected void setUp() throws Exception
{
  super.setUp();
  this.fsManager = new StandardFileSystemManager();
  this.fsManager.init();
  this.fileHandler = new VFSFileHandler(this.fsManager);
  this.installer = new ZipURLInstaller(new URL("http://some/url/resin-3.0.18.zip"));
  this.installer.setFileHandler(this.fileHandler);
}

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

/**
 * Test {@link ZipURLInstaller#install()} successful with no proxy.
 * @throws Exception If anything goes wrong.
 */
public void testSuccessfulDownloadWhenNoProxySet() throws Exception
{
  // Clear any proxy setting
  new Proxy().clear();
  this.installer.setAntTaskFactory(
    new AntTaskFactory()
    {
      @Override
      public Task createTask(String taskName)
      {
        return new HarmlessGet();
      }
    });
  this.installer.download();
  assertNull("Proxy host should not have been set", System.getProperty("http.proxyHost"));
}

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

/**
   * Install container using {@link ZipURLInstaller}.
   * @return Location in which the container has been installed.
   */
  private String installContainer()
  {
    ZipURLInstaller installer = new ZipURLInstaller(getTestData().installURL,
      getTestData().downloadDir, getTestData().extractDir);
    installer.setLogger(getLogger());

    // Set up proxy
    if (getTestData().proxy != null)
    {
      Proxy userProxy = getTestData().proxy;
      userProxy.setLogger(getLogger());
      installer.setProxy(userProxy);
    }
    installer.install();

    return installer.getHome();
  }
}

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

/**
 * Set up a home dir (possibly using a ZipURLInstaller).
 */
protected void setupHome()
{
  if (getHome() != null)
  {
    ((InstalledLocalContainer) getContainer()).setHome(getHome());
  }
  else if (getZipURLInstaller() != null)
  {
    ZipURLInstaller installer = getZipURLInstaller().createInstaller();
    installer.setLogger(getContainer().getLogger());
    installer.install();
    ((InstalledLocalContainer) getContainer()).setHome(installer.getHome());
  }
}

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

/**
 * Creates the {@link ZipURLInstaller} with the appropriate configuration.
 * @param projectBuildDirectory Project build directory.
 * @return a new instance of {@link ZipURLInstaller} configured using the attributes specified
 * by the user
 */
public ZipURLInstaller createInstaller(String projectBuildDirectory)
{
  String extractDir = getExtractDir();
  if (extractDir == null)
  {
    extractDir = new File(projectBuildDirectory, EXTRACT_SUBDIRECTORY).getPath();
  }
  ZipURLInstaller installer = new ZipURLInstaller(getUrl(), getDownloadDir(), extractDir);
  if (getProxy() != null)
  {
    installer.setProxy(getProxy());
  }
  return installer;
}

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

installer.setLogger(getContainer().getLogger());
if (!installer.isAlreadyDownloaded())
  installer.download();
  zipURLInstallerElement.createInstaller().getDownloadFile());

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

/**
 * Test {@link ZipURLInstaller#install()} successful with a proxy.
 * @throws Exception If anything goes wrong.
 */
public void testSuccessfulDownloadWhenProxySet() throws Exception
{
  this.installer.setAntTaskFactory(
    new AntTaskFactory()
    {
      @Override
      public Task createTask(String taskName)
      {
        return new HarmlessGet();
      }
    });
  Proxy proxy = new Proxy();
  proxy.setHost("proxyhost");
  this.installer.setProxy(proxy);
  this.installer.download();
  assertEquals(System.getProperty("http.proxyHost"), proxy.getHost());
}

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

/**
   * Test {@link ZipURLInstaller#getHome()} when container installed in two levels.
   * @throws Exception If anything goes wrong.
   */
  public void testGetHomeWhenContainerDistributionUnzipsInTwoLevels() throws Exception
  {
    this.fsManager.resolveFile("ram:///tmp/resin-3.0.18/resin-3.0.18/bin").createFolder();
    this.fsManager.resolveFile("ram:///tmp/resin-3.0.18/resin-3.0.18/lib").createFolder();
    this.fsManager.resolveFile("ram:///tmp/resin-3.0.18/resin-3.0.18/webapps").createFolder();
    this.fsManager.resolveFile("ram:///tmp/resin-3.0.18/.cargo").createFile();

    this.installer.setExtractDir("ram:///tmp");

    assertEquals("ram:///tmp/resin-3.0.18/resin-3.0.18", this.installer.getHome());
  }
}

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

/**
   * @return a new instance of {@link ZipURLInstaller} configured using the attributes specified
   * by the user
   */
  public ZipURLInstaller createInstaller()
  {
    ZipURLInstaller installer = new ZipURLInstaller(getInstallURL(), getDownloadDir(),
      getExtractDir());
    if (getProxy() != null)
    {
      installer.setProxy(getProxy());
    }
    return installer;
  }
}

代码示例来源: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();

相关文章