Examples of retrieveItem()


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

    repository.storeItem(false, new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(item.getPath() + ".md5"), true, true, new StringContentLocator(md5str))
    );

    // reread the item to refresh attributes map
    item = repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));

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

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

    // reread the item to refresh attributes map
    item = repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));

    StorageFileItem sha1 =
        (StorageFileItem) repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.sha1"));
    Assert.assertEquals(item.getRepositoryItemAttributes().get(ChecksumContentValidator.ATTR_REMOTE_SHA1),
        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()

        sha1str);
    Assert.assertEquals(item.getModified(), sha1.getModified());
    Assert.assertEquals(40, sha1.getLength());

    StorageFileItem md5 =
        (StorageFileItem) repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt.md5"));
    Assert.assertEquals(item.getRepositoryItemAttributes().get(ChecksumContentValidator.ATTR_REMOTE_MD5), 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()

    assertThat("File timestamp did not change, first pass", mdFile.lastModified(), not(equalTo(fileTimestamp)));
    fileTimestamp = mdFile.lastModified();

    // We need to wait a bit to avoid the check that last remote check = current time
    Thread.sleep(500);
    final StorageItem item = repository.retrieveItem(new ResourceStoreRequest(path, false));
    getLogger().info(
        path + " -> BEFORE assert 1 requestCount=" + expectedHits[0] + " at (" + System.currentTimeMillis() + ")");
    assertThat("Remote hits count fail after first request at (" + System.currentTimeMillis() + ")",
        ch.getRequestCount(), equalTo(expectedHits[0]));
    getLogger().info(
View Full Code Here

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

    fileTimestamp = mdFile.lastModified();

    // We need to wait a bit to avoid the check that last remote check = current time
    Thread.sleep(500);
    // this goes remote depending on age setting
    repository.retrieveItem(new ResourceStoreRequest(path, false));
    getLogger().info(
        path + " -> BEFORE assert 2 requestCount=" + expectedHits[1] + " at (" + System.currentTimeMillis() + ")");
    assertThat("Remote hits count fail after second request at (" + System.currentTimeMillis() + ")",
        ch.getRequestCount(), equalTo(expectedHits[1]));
    getLogger().info(
View Full Code Here

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

    attributes.setCheckedRemotely(System.currentTimeMillis() - ((Math.abs(age) + 1) * 60 * 1000));
    storage.putAttributes(uid, attributes);

    // We need to wait a bit to avoid the check that last remote check = current time
    Thread.sleep(500);
    repository.retrieveItem(new ResourceStoreRequest(path, false));
    getLogger().info(
        path + " -> BEFORE assert 3 requestCount=" + expectedHits[2] + " at (" + System.currentTimeMillis() + ")");
    assertThat("Remote hits count fail after third request at (" + System.currentTimeMillis() + ")",
        ch.getRequestCount(), equalTo(expectedHits[2]));
    getLogger().info(
View Full Code Here

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

    M2Repository repository = (M2Repository) this.getRepositoryRegistry().getRepository("repo1");

    String item = "/org/slf4j/slf4j-api/1.4.3/slf4j-api-1.4.3.pom";
    ResourceStoreRequest request = new ResourceStoreRequest(item);
    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.maven2.M2Repository.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(
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.maven2.M2Repository.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.maven2.M2Repository.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(
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.