Examples of retrieveItem()


Examples of org.sonatype.nexus.proxy.maven.maven1.M1Repository.retrieveItem()

    FileUtils.write(artifactFile, "Some Text so the file is not empty");

    ResourceStoreRequest request = new ResourceStoreRequest(itemPath);
    request.getRequestContext().put(AccessManager.REQUEST_REMOTE_ADDRESS, "127.0.0.1");
    StorageItem storageItem = repository.retrieveItem(request);
    long lastRequest = System.currentTimeMillis() - 10 * A_DAY;
    storageItem.setLastRequested(lastRequest);
    repository.storeItem(false, storageItem);

    // now request the object, the lastRequested timestamp should be updated
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven1.M1Repository.retrieveItem()

    long lastRequest = System.currentTimeMillis() - 10 * A_DAY;
    storageItem.setLastRequested(lastRequest);
    repository.storeItem(false, storageItem);

    // now request the object, the lastRequested timestamp should be updated
    StorageItem resultItem = repository.retrieveItem(request);
    Assert.assertTrue(resultItem.getLastRequested() > lastRequest);

    // check the shadow attributes
    Attributes shadowStorageItem = repository.getAttributesHandler().getAttributeStorage().getAttributes(
        repository.createUid(request.getRequestPath()));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2GroupRepository.retrieveItem()

    final GroupRepository group =
        getRepositoryRegistry().getRepositoryWithFacet("another-test", GroupRepository.class);

    try {
      group.retrieveItem(new ResourceStoreRequest("/some/path/that/we/know/is/not/existing/123456/12.foo"));
      // anything else should fail
      fail("We expected an exception here!");
    }
    catch (GroupItemNotFoundException e) {
      final String dumpStr = dumpNotFoundReasoning(e, 0);
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.retrieveItem()

  {
    final M2Repository repository = (M2Repository) getResourceStore();

    Assert.assertTrue(repository.getRepositoryKind().isFacetAvailable(ProxyRepository.class));

    StorageItem item = repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));

    StorageFileItem sha1 =
        (StorageFileItem) repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.sha1"));
    String sha1str = MUtils.readDigestFromFileItem((StorageFileItem) sha1);
    Assert.assertEquals(item.getRepositoryItemAttributes().get(StorageFileItem.DIGEST_SHA1_KEY), sha1str);
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.retrieveItem()

    Assert.assertTrue(repository.getRepositoryKind().isFacetAvailable(ProxyRepository.class));

    StorageItem item = repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));

    StorageFileItem sha1 =
        (StorageFileItem) repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.sha1"));
    String sha1str = MUtils.readDigestFromFileItem((StorageFileItem) sha1);
    Assert.assertEquals(item.getRepositoryItemAttributes().get(StorageFileItem.DIGEST_SHA1_KEY), sha1str);
    Assert.assertEquals(item.getModified(), sha1.getModified());
    Assert.assertEquals(40, sha1.getLength());
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.retrieveItem()

    Assert.assertEquals(item.getRepositoryItemAttributes().get(StorageFileItem.DIGEST_SHA1_KEY), sha1str);
    Assert.assertEquals(item.getModified(), sha1.getModified());
    Assert.assertEquals(40, sha1.getLength());

    StorageFileItem md5 =
        (StorageFileItem) repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.md5"));
    String md5str = MUtils.readDigestFromFileItem((StorageFileItem) md5);
    Assert.assertEquals(item.getRepositoryItemAttributes().get(StorageFileItem.DIGEST_MD5_KEY), md5str);
    Assert.assertEquals(item.getModified(), md5.getModified());
    Assert.assertEquals(32, md5.getLength());
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.retrieveItem()

    catch (ItemNotFoundException expected) {
      // expected
    }

    // cache an item and its checksums
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.sha1"));
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.md5"));

    Collection<StorageItem> items = repository.list(new ResourceStoreRequest("/spoof"));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.retrieveItem()

      // expected
    }

    // cache an item and its checksums
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.sha1"));
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.md5"));

    Collection<StorageItem> items = repository.list(new ResourceStoreRequest("/spoof"));

    Map<String, StorageItem> paths = new HashMap<String, StorageItem>();
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.retrieveItem()

    }

    // cache an item and its checksums
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.sha1"));
    repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.md5"));

    Collection<StorageItem> items = repository.list(new ResourceStoreRequest("/spoof"));

    Map<String, StorageItem> paths = new HashMap<String, StorageItem>();
    for (StorageItem item : items) {
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.retrieveItem()

    Assert.assertTrue(repository.getRepositoryKind().isFacetAvailable(ProxyRepository.class));

    String sha1str = "0123456789012345678901234567890123456789";
    String md5str = "01234567012345670123456701234567";

    StorageItem item = repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));

    repository.storeItem(false, new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(item.getPath() + ".sha1"), true, true, new StringContentLocator(sha1str))
    );
    repository.storeItem(false, new DefaultStorageFileItem(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.