Examples of storeItem()


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

    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(
        repository, new ResourceStoreRequest(item.getPath() + ".md5"), true, true, new StringContentLocator(md5str))
    );
View Full Code Here

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

    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(
        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"));
View Full Code Here

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

    DefaultStorageFileItem item = new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(SPOOF_RELEASE), true, true, new StringContentLocator(SPOOF_RELEASE)
    );

    repository.storeItem(false, item);

    try {
      item = new DefaultStorageFileItem(
          repository, new ResourceStoreRequest(SPOOF_SNAPSHOT), true, true, new StringContentLocator(SPOOF_SNAPSHOT)
      );
View Full Code Here

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

    try {
      item = new DefaultStorageFileItem(
          repository, new ResourceStoreRequest(SPOOF_SNAPSHOT), true, true, new StringContentLocator(SPOOF_SNAPSHOT)
      );

      repository.storeItem(false, item);

      assertThat("Should not be able to store snapshot to release repo", false);
    }
    catch (UnsupportedStorageOperationException e) {
      // good
View Full Code Here

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

    item = new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(SPOOF_SNAPSHOT), true, true, new StringContentLocator(SPOOF_SNAPSHOT)
    );

    repository.storeItem(false, item);

    try {
      item = new DefaultStorageFileItem(
          repository, new ResourceStoreRequest(SPOOF_RELEASE), true, true, new StringContentLocator(SPOOF_RELEASE)
      );
View Full Code Here

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

    try {
      item = new DefaultStorageFileItem(
          repository, new ResourceStoreRequest(SPOOF_RELEASE), true, true, new StringContentLocator(SPOOF_RELEASE)
      );

      repository.storeItem(false, item);

      assertThat("Should not be able to store release to snapshot repo", false);
    }
    catch (UnsupportedStorageOperationException e) {
      // good
View Full Code Here

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

    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
    StorageItem resultItem = repository.retrieveItem(request);
    Assert.assertTrue(resultItem.getLastRequested() > lastRequest);

View Full Code Here

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

    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
    StorageItem resultItem = repository.retrieveItem(request);
    Assert.assertTrue(resultItem.getLastRequested() > lastRequest);

View Full Code Here

Examples of org.sonatype.nexus.proxy.repository.Repository.storeItem()

    final Repository repository = getRepositoryRegistry().getRepository("inhouse");
    final ResourceStoreRequest request =
        new ResourceStoreRequest("/activemq/activemq-core/1.2/activemq-core-1.2.jar", true);

    try {
      repository.storeItem(request, new FilterInputStream(new ByteArrayInputStream(
          "123456789012345678901234567890".getBytes()))
      {
        @Override
        public int read()
            throws IOException
View Full Code Here

Examples of org.sonatype.nexus.proxy.repository.Repository.storeItem()

      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()));
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.