Package org.sonatype.nexus.proxy.maven

Examples of org.sonatype.nexus.proxy.maven.MavenHostedRepository


    if (isPrefixFileEvent(evt)) {
      handlePrefixFileUpdate(evt);
    }
    else if (isPlainFileItemEvent(evt)) {
      // we maintain prefix list for hosted reposes only!
      final MavenHostedRepository mavenHostedRepository =
          evt.getRepository().adaptToFacet(MavenHostedRepository.class);
      if (mavenHostedRepository != null) {
        offerPath(mavenHostedRepository, evt.getItem());
      }
    }
View Full Code Here


    if (isPrefixFileEvent(evt)) {
      handlePrefixFileUpdate(evt);
    }
    else if (isPlainFileItemEvent(evt)) {
      // we maintain prefix list for hosted reposes only!
      final MavenHostedRepository mavenHostedRepository =
          evt.getRepository().adaptToFacet(MavenHostedRepository.class);
      if (mavenHostedRepository != null) {
        offerPath(mavenHostedRepository, evt.getItem());
      }
    }
View Full Code Here

    if (isPrefixFileEvent(evt)) {
      handlePrefixFileRemoval(evt);
    }
    else if (evt instanceof RepositoryItemEventDeleteRoot && isPlainItemEvent(evt)) {
      // we maintain prefix list for hosted reposes only!
      final MavenHostedRepository mavenHostedRepository =
          evt.getRepository().adaptToFacet(MavenHostedRepository.class);
      if (mavenHostedRepository != null) {
        revokePath(mavenHostedRepository, evt.getItem());
      }
    }
View Full Code Here

    assertTrue("repo is hosted", patient.getRepositoryKind().isFacetAvailable(MavenHostedRepository.class));
    assertFalse("repo is not proxied", patient.getRepositoryKind().isFacetAvailable(ProxyRepository.class));
    assertFalse("repo is not proxied", patient.getRepositoryKind().isFacetAvailable(MavenProxyRepository.class));

    // now we just walk in, like nothing of above happened :)
    MavenHostedRepository afterTreatment =
        getRepositoryRegistry().getRepositoryWithFacet(patient.getId(), MavenHostedRepository.class);

    assertNotNull("It should exists (heh, but NoSuchRepo exception should be thrown anyway)", afterTreatment);
  }
View Full Code Here

      throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage(), e);
    }
    catch (ResourceException e) {
      if (Status.CLIENT_ERROR_BAD_REQUEST.getCode() == e.getStatus().getCode()) {
        // try with hosted
        final MavenHostedRepository mavenRepository = getMavenRepository(request, MavenHostedRepository.class);
        getManager().updatePrefixFile(mavenRepository);
        // we spawned a background job, so say "okay, we accepted this, but come back later for results"
        response.setStatus(Status.SUCCESS_ACCEPTED);
      }
      else {
View Full Code Here

  public void testDeployOfCustomPackaging()
      throws Exception
  {
    final File jarFile = getTestFile("src/test/resources/nexus-5525/bundle-1.0-20130318.131408-1.jar");
    final File pomFile = getTestFile("src/test/resources/nexus-5525/bundle-1.0-20130318.131408-1.pom");
    final MavenHostedRepository snapshots =
        lookup(RepositoryRegistry.class).getRepositoryWithFacet("snapshots", MavenHostedRepository.class);
    lookup(ArtifactPackagingMapper.class).setPropertiesFile(
        getTestFile("src/test/resources/nexus-5525/packaging2extension-mapping.properties"));

    // simulate Maven3 deploy: it happens JAR then POM
    snapshots.storeItem(
        new ResourceStoreRequest("/org/sonatype/nexus5525/bundle/1.0-SNAPSHOT/" + jarFile.getName()),
        new FileInputStream(jarFile), null);
    snapshots.storeItem(
        new ResourceStoreRequest("/org/sonatype/nexus5525/bundle/1.0-SNAPSHOT/" + pomFile.getName()),
        new FileInputStream(pomFile), null);

    wairForAsyncEventsToCalmDown();

    IteratorSearchResponse response = null;
    try {
      // check index
      response =
          lookup(IndexerManager.class).searchArtifactIterator("org.sonatype.nexus5525", "bundle", null,
              "bundle", null, snapshots.getId(), null, null, null, false, SearchType.EXACT, null);

      assertThat(response.getTotalHitsCount(), equalTo(1));
      final ArtifactInfo ai = response.getResults().next();

      assertThat(ai.packaging, equalTo("bundle"));
View Full Code Here

  private YumHostedImpl yum;

  @Before
  public void activateService() {
    final MavenHostedRepository repository = createRepository(SNAPSHOTS);
    repositoryRegistry.addRepository(repository);
    yum = (YumHostedImpl) yumRegistry.register(repository);
  }
View Full Code Here

    assertNotSame(repo1, repo2);
  }

  public static MavenHostedRepository createRepository(String id) {
    final MavenHostedRepository repository = mock(MavenHostedRepository.class);
    when(repository.getId()).thenReturn(id);
    when(repository.getLocalUrl()).thenReturn(getTempUrl());
    when(repository.getProviderRole()).thenReturn(Repository.class.getName());
    when(repository.getProviderHint()).thenReturn("maven2");
    when(repository.adaptToFacet(HostedRepository.class)).thenReturn(repository);
    when(repository.adaptToFacet(MavenRepository.class)).thenReturn(repository);
    when(repository.adaptToFacet(MavenHostedRepository.class)).thenReturn(repository);
    final RepositoryItemUid uid = mock(RepositoryItemUid.class);
    when(uid.getLock()).thenReturn(mock(RepositoryItemUidLock.class));
    when(repository.createUid(anyString())).thenReturn(uid);
    when(repository.getRepositoryContentClass()).thenReturn(new Maven2ContentClass());
    when(repository.isExposed()).thenReturn(true);

    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    Mockito.<Class<?>>when(repositoryKind.getMainFacet()).thenReturn(MavenHostedRepository.class);
    when(repositoryKind.isFacetAvailable(HostedRepository.class)).thenReturn(true);
    when(repositoryKind.isFacetAvailable(MavenRepository.class)).thenReturn(true);
    when(repositoryKind.isFacetAvailable(MavenHostedRepository.class)).thenReturn(true);
    return repository;
View Full Code Here

    final List<String> visitedChildren = new ArrayList<String>();
    // list of parent collections having onCollectionExit invoked with
    final List<String> exitedCollections = new ArrayList<String>();

    // get the repo and tap in modified LS implementation
    final MavenHostedRepository testRepo =
        getRepositoryRegistry().getRepositoryWithFacet(REPO_ID, MavenHostedRepository.class);
    // tap in FSPeer that has mines planted
    // everything as usual, exception FSPeer implementation
    testRepo.setLocalStorage(new DefaultFSLocalRepositoryStorage(lookup(Wastebasket.class),
        lookup(LinkPersister.class), lookup(MimeSupport.class), new TestingDefaultFSPeer(minedParents)));

    // Create context and processors for the walk
    final DefaultWalkerContext context = new DefaultWalkerContext(testRepo, new ResourceStoreRequest("/"));
    context.getProcessors().add(new AbstractFileWalkerProcessor()
View Full Code Here

  public void shouldReuseQueuedTaskOfTheSameType()
      throws Exception
  {
    final File tmpDir = copyToTempDir(rpmsDir());

    final MavenHostedRepository repository = mock(MavenHostedRepository.class);
    when(repository.getId()).thenReturn("REPO");
    when(repository.getLocalUrl()).thenReturn(osIndependentUri(tmpDir));
    when(repository.getProviderRole()).thenReturn(Repository.class.getName());
    when(repository.getProviderHint()).thenReturn("maven2");
    when(repository.adaptToFacet(HostedRepository.class)).thenReturn(repository);
    when(repository.adaptToFacet(MavenRepository.class)).thenReturn(repository);
    when(repository.adaptToFacet(MavenHostedRepository.class)).thenReturn(repository);
    final RepositoryItemUid uid = mock(RepositoryItemUid.class);
    when(uid.getLock()).thenReturn(mock(RepositoryItemUidLock.class));
    when(repository.createUid(anyString())).thenReturn(uid);
    when(repository.getRepositoryContentClass()).thenReturn(new Maven2ContentClass());
    when(repository.isExposed()).thenReturn(true);
    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
    Mockito.<Class<?>>when(repositoryKind.getMainFacet()).thenReturn(MavenHostedRepository.class);
    when(repositoryKind.isFacetAvailable(HostedRepository.class)).thenReturn(true);
    when(repositoryKind.isFacetAvailable(MavenRepository.class)).thenReturn(true);
    when(repositoryKind.isFacetAvailable(MavenHostedRepository.class)).thenReturn(true);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);

    final File rpm1 = createDummyRpm(RPM_NAME_1, "1", new File(tmpDir, "rpm1"));
    final File rpm2 = createDummyRpm(RPM_NAME_2, "2", new File(tmpDir, "rpm2"));

    // given executions blocking all thread of the scheduler
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.maven.MavenHostedRepository

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.