Package org.sonatype.nexus.proxy

Examples of org.sonatype.nexus.proxy.ResourceStoreRequest


      return;
    }

    log.info("Syncing shadow " + getId() + " with master repository " + getMasterRepository().getId());

    final ResourceStoreRequest root = new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT, true);

    expireNotFoundCaches(root);

    final AbstractFileWalkerProcessor sw = new AbstractFileWalkerProcessor()
    {
View Full Code Here


    byte[] bytes = (digest + '\n').getBytes("UTF-8");

    ContentLocator contentLocator = new ByteArrayContentLocator(bytes, mimeType);

    ResourceStoreRequest req = new ResourceStoreRequest(digestFileName);

    req.getRequestContext().setParentContext(request.getRequestContext());

    // Metadata checksum files are not composite ones, they are derivatives of the Metadata (and metadata file _is_
    // composite one)
    DefaultStorageFileItem digestFileItem = new DefaultStorageFileItem(this, req, true, false, contentLocator);
View Full Code Here

          }
          // we have to keep original reqest's flags: localOnly and remoteOnly are strange ones, so
          // we do a hack here
          // second, since we initiate a request for different path within a context of this request,
          // we need to be careful about it
          ResourceStoreRequest mdRequest =
              new ResourceStoreRequest(path, request.isRequestLocalOnly(), request.isRequestRemoteOnly());
          mdRequest.getRequestContext().setParentContext(request.getRequestContext());

          mdItem = (StorageFileItem) super.retrieveItem(false, mdRequest);
        }
        else {
          mdItem = (StorageFileItem) super.doRetrieveItem(request);
View Full Code Here

    scan.setBasedir(repoBase);
    scan.addDefaultExcludes();
    scan.scan();

    for (String path : scan.getIncludedFiles()) {
      ResourceStoreRequest request = new ResourceStoreRequest(path, true);

      FileInputStream fis = new FileInputStream(new File(repoBase, path));

      if (M2ArtifactRecognizer.isSnapshot(path)) {
        inhouseSnapshot.storeItem(request, fis, null);
View Full Code Here

  private void rebuildMavenMetadata(Repository repo) {
    RecreateMavenMetadataWalkerProcessor wp = new RecreateMavenMetadataWalkerProcessor(getLogger());

    DefaultWalkerContext ctx =
        new DefaultWalkerContext(repo, new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT, true));

    ctx.getProcessors().add(wp);

    walker.walk(ctx);
  }
View Full Code Here

  private void validateResults(Repository repository, Map<String, Boolean> results)
      throws Exception
  {
    for (Map.Entry<String, Boolean> entry : results.entrySet()) {
      try {
        ResourceStoreRequest req = new ResourceStoreRequest(entry.getKey(), true);

        repository.retrieveItem(req);

        // we succeeded, the value must be true
        assertTrue(
View Full Code Here

    final Repository repo = inhouseRelease;

    // == 1st pass: we recreate all the maven metadata for given repo to have them all in place
    {
      final DefaultWalkerContext ctx =
          new DefaultWalkerContext(repo, new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT, true));
      ctx.getProcessors().add(new RecreateMavenMetadataWalkerProcessor(getLogger()));
      walker.walk(ctx);
    }

    // === 2nd pass: all MD is recreated, and they are valid, NO overwrite should happen at all!
    {
      final DefaultWalkerContext ctx =
          new DefaultWalkerContext(repo, new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT, true));
      ctx.getProcessors().add(new RecreateMavenMetadataWalkerProcessor(getLogger()));
      final ValidationEventListener validationEventListener = new ValidationEventListener();
      eventBus().register(validationEventListener);
      walker.walk(ctx);
      eventBus().unregister(validationEventListener);
      assertFalse("We should not record any STORE!", validationEventListener.hasStoresRecorded());
    }

    // === 3rd pass: e manually "break" one checksum, and expect that one only to be overwritten
    {
      final String checksumPath = "/com/mycom/group1/maven-metadata.xml.sha1";
      final String checksumPathMd5 = "/com/mycom/group1/maven-metadata.xml.md5";
      // coming from http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.pom.sha1
      final String wrongChecksum = "93c66c9afd6cf7b91bd4ecf38a60ca48fc5f2078";

      repo.storeItem(new ResourceStoreRequest(checksumPath),
          new ByteArrayInputStream(wrongChecksum.getBytes("UTF-8")), null);

      final DefaultWalkerContext ctx =
          new DefaultWalkerContext(repo, new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT, true));
      ctx.getProcessors().add(new RecreateMavenMetadataWalkerProcessor(getLogger()));
      final ValidationEventListener validationEventListener = new ValidationEventListener();
      eventBus().register(validationEventListener);
      walker.walk(ctx);
      eventBus().unregister(validationEventListener);
View Full Code Here

  public void testRecreateMavenMetadataWalkerWalkerRelease()
      throws Exception
  {
    rebuildMavenMetadata(inhouseRelease);

    assertNotNull(inhouseRelease.retrieveItem(new ResourceStoreRequest("/junit/junit/maven-metadata.xml", false)));

  }
View Full Code Here

  public void testRecreateMavenMetadataWalkerWalkerSnapshot()
      throws Exception
  {
    rebuildMavenMetadata(inhouseSnapshot);

    assertNotNull(inhouseSnapshot.retrieveItem(new ResourceStoreRequest(
        "/org/sonatype/nexus/nexus-api/maven-metadata.xml", false)));

    assertNotNull(inhouseSnapshot.retrieveItem(new ResourceStoreRequest(
        "/org/sonatype/nexus/nexus-api/1.2.0-SNAPSHOT/maven-metadata.xml", false)));
  }
View Full Code Here

  public void testRecreateMavenMetadataWalkerWalkerSnapshotWithInterpolation()
      throws Exception
  {
    rebuildMavenMetadata(inhouseSnapshot);

    assertNotNull(inhouseSnapshot.retrieveItem(new ResourceStoreRequest(
        "/nexus1332/artifact-interp-main/maven-metadata.xml", false)));

    assertNotNull(inhouseSnapshot.retrieveItem(new ResourceStoreRequest(
        "/nexus1332/artifact-interp-main/14.0.0-SNAPSHOT/maven-metadata.xml", false)));
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.ResourceStoreRequest

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.