Package org.sonatype.nexus.client.core.subsystem.content

Examples of org.sonatype.nexus.client.core.subsystem.content.Location


  protected File downloadFromSite(final String repositoryId, final String path)
      throws IOException
  {
    final File downloaded = new File(testIndex().getDirectory("downloads"), path);
    client().getSubsystem(Content.class).download(new Location(repositoryId, path), downloaded);
    return downloaded;
  }
View Full Code Here


  private Location location;

  @Before
  public void prepare() throws IOException {
    location = new Location("releases", "/some/content/" + testMethodName() + ".txt");
    final File target = File.createTempFile(testMethodName(), "tmp");
    Files.write(TEST_DATA, target, CHARSET);
    content().upload(location, target);
  }
View Full Code Here

  {
    final MavenHostedRepository repository = repositories()
        .create(MavenHostedRepository.class, repositoryIdForTest())
        .save();

    final Location location = repositoryLocation(repository.id(), AOP_POM);

    final File toDeploy = testData().resolveFile("artifacts/" + AOP_POM);
    final File downloaded = new File(testIndex().getDirectory("downloads"), "aopalliance-1.0.pom");

    content().upload(location, toDeploy);
View Full Code Here

    final File felixRepo = util.resolveFile("target/felix-local-repository");
    final File felixConfig = testData().resolveFile("felix.properties");

    // ensure we have an obr.xml
    final Content content = content();
    final Location obrLocation = new Location(repoId, ".meta/obr.xml");
    content.download(
        obrLocation,
        new File(testIndex().getDirectory("downloads"), repoId + "-obr.xml")
    );

    FileUtils.deleteDirectory(new File(felixHome, "felix-cache"));
    FileUtils.deleteDirectory(new File(felixRepo, ".meta"));

    final ProcessBuilder pb = new ProcessBuilder(
        "java", "-Dfelix.felix.properties=" + felixConfig.toURI(), "-jar", "bin/felix.jar"
    );
    pb.directory(felixHome);
    pb.redirectErrorStream(true);
    final Process p = pb.start();

    final Object lock = new Object();

    final Thread t = new Thread(new Runnable()
    {
      public void run() {
        // just a safeguard, if felix get stuck kill everything
        try {
          synchronized (lock) {
            lock.wait(5 * 1000 * 60);
          }
        }
        catch (final InterruptedException e) {
          // ignore
        }
        p.destroy();
      }
    });
    t.setDaemon(true);
    t.start();

    synchronized (lock) {
      final InputStream input = p.getInputStream();
      final OutputStream output = p.getOutputStream();
      waitFor(input, "g!");

      output.write(
          ("obr:repos add " + nexus().getUrl() + "content/" + obrLocation.toContentPath() + "\r\n").getBytes()
      );
      output.flush();
      waitFor(input, "g!");

      output.write(
View Full Code Here

  }

  protected void upload(final String repositoryId, final String path)
      throws IOException
  {
    content().upload(new Location(repositoryId, path),
        util.resolveFile("target/felix-local-repository/" + path));
  }
View Full Code Here

  protected File download(final String repositoryId, final String path)
      throws IOException
  {
    final File downloaded = new File(testIndex().getDirectory("downloads"), path);
    content().download(new Location(repositoryId, path), downloaded);
    return downloaded;
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.client.core.subsystem.content.Location

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.