Examples of RepositoryRegistry


Examples of npanday.registry.RepositoryRegistry

        if ( !logs.exists() )
        {
            logs.mkdir();
        }

        RepositoryRegistry repositoryRegistry;
        try
        {
            repositoryRegistry = npandayRegistry.createRepositoryRegistry();
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException(
                "NPANDAY-1600-000: Failed to create the repository registry for this plugin", e );
        }
        catch( NPandayRepositoryException e )
        {
            throw new MojoExecutionException(
                "NPANDAY-1600-007: Failed to create the repository registry for this plugin", e );
        }

        NetDependenciesRepository netRepository = (NetDependenciesRepository) repositoryRegistry.find(
            "net-dependencies" );

        artifactContext.init( null, mavenProject.getRemoteArtifactRepositories(), new File( localRepository ) );
        Map<String, ArtifactHandler> map = new HashMap<String, ArtifactHandler>();
View Full Code Here

Examples of npanday.registry.RepositoryRegistry

            localRepository = new File( System.getProperty( "user.home" ), ".m2/repository" );
        }

        String profile = System.getProperty( "dependencyProfile" );

        RepositoryRegistry repositoryRegistry;
        try
        {
            repositoryRegistry = npandayRegistry.createRepositoryRegistry();
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException(
                "NPANDAY-1600-000: Failed to create the repository registry for this plugin", e );
        }
        catch( NPandayRepositoryException e )
        {
            throw new MojoExecutionException(
                "NPANDAY-1600-007: Failed to create the repository registry for this plugin", e );
        }

        if ( netDependencies == null )
        {
            netDependencies = new NetDependency[0];
        }
        List<Dependency> dependencies = new ArrayList<Dependency>();
        for ( NetDependency netDependency : netDependencies )
        {
            Dependency dependency = new Dependency();
            dependency.setGroupId( netDependency.getGroupId() );
            dependency.setArtifactId( netDependency.getArtifactId() );
            dependency.setVersion( netDependency.getVersion() );
            dependency.setScope( Artifact.SCOPE_RUNTIME );
            dependency.setType( netDependency.getType() );
            dependencies.add( dependency );
        }

        artifactContext.init( project, project.getRemoteArtifactRepositories(), localRepository );
        if ( !new File( localRepository, "npanday.artifacts.resolved" ).exists() ) //performance optimization
        {
            try
            {
                artifactContext.getArtifactInstaller().resolveAndInstallNetDependenciesForProfile( profile,
                                                                                                   dependencies, null );
            }
            catch ( NPandayArtifactResolutionException e )
            {
               throw new MojoExecutionException( e.getMessage(), e );
            }
            catch ( IOException e )
            {
               throw new MojoExecutionException( e.getMessage(), e );
            }

            new File( localRepository, "npanday.artifacts.resolved" ).mkdir();
        }

        //Do GAC Install, if needed
        //TODO: Add in the dependencies from the MOJO config
        if ( isGacInstall )
        {
            NetDependenciesRepository repository =
                (NetDependenciesRepository) repositoryRegistry.find( "net-dependencies" );
            getLog().info( "NPANDAY-1600-001: Found net dependencies: Number = " + dependencies.size() );

            List<NetDependencyMatchPolicy> gacInstallPolicies = new ArrayList<NetDependencyMatchPolicy>();
            gacInstallPolicies.add( new GacMatchPolicy( true ) );
            List<Dependency> gacInstallDependencies = repository.getDependenciesFor( gacInstallPolicies );
View Full Code Here

Examples of npanday.registry.RepositoryRegistry

    public void postExecute()
        throws MojoExecutionException, MojoFailureException
    {
        try
        {
            RepositoryRegistry repositoryRegistry = (RepositoryRegistry) container.lookup( RepositoryRegistry.ROLE );
            SettingsRepository settingsRepository = (SettingsRepository) repositoryRegistry.find( "npanday-settings" );
            if ( settingsRepository != null )
            {
                settingsRepository.reload();
            }
        }
View Full Code Here

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry

  @Test
  public void testDisposeInvoked()
      throws Exception
  {
    final RepositoryTypeRegistry repositoryTypeRegistry = lookup(RepositoryTypeRegistry.class);
    final RepositoryRegistry repositoryRegistry = lookup(RepositoryRegistry.class);
    final NexusConfiguration nexusConfiguration = lookup(NexusConfiguration.class);
    final TemplateManager templateManager = lookup(TemplateManager.class);

    // register this
    repositoryTypeRegistry.registerRepositoryTypeDescriptors(new RepositoryTypeDescriptor(Repository.class,
        Nexus4807RepositoryImpl.ID, "foo"));

    // load config
    nexusConfiguration.loadConfiguration();

    // assert we have peter not present
    try {
      repositoryRegistry.getRepository("peter");
      Assert.fail("Peter should not be present!");
    }
    catch (NoSuchRepositoryException e) {
      // good, it should be not present
    }

    // create this new repo type
    final RepositoryTemplate template =
        (RepositoryTemplate) templateManager.getTemplates().getTemplateById("nexus4807");
    template.getConfigurableRepository().setId("peter");
    template.getConfigurableRepository().setName("We all love Peter!");
    final Repository repository = template.create();

    // do some simple assertion
    assertThat(repository.getId(), equalTo("peter"));
    assertThat(repository.getName(), equalTo("We all love Peter!"));
    // assert peter is here simply, by having this below not throw any exception and returning non-null
    // note: by interface contract, this method never returns null: either returns value or throws exception
    assertThat(repositoryRegistry.getRepository("peter"), notNullValue());

    // now drop it
    nexusConfiguration.deleteRepository(repository.getId());

    // assert peter left the building
    try {
      repositoryRegistry.getRepository("peter");
      Assert.fail("Peter should not be present, he just left!");
    }
    catch (NoSuchRepositoryException e) {
      // good, he left of main entrance
    }
View Full Code Here

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry

    try {
      // lookup nexus, this will do all sort of things, amongst them validate the config
      startNx();

      RepositoryRegistry repositoryRegistry = lookup(RepositoryRegistry.class);

      MavenGroupRepository publicGroup =
          repositoryRegistry.getRepositoryWithFacet("public", MavenGroupRepository.class);

      List<String> memberIds = new ArrayList<String>();
      for (Repository repo : publicGroup.getMemberRepositories()) {
        memberIds.add(repo.getId());
      }
View Full Code Here

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry

  @Test
  public void shouldFailOnProxyRepositories()
      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository proxyRepository = mock(Repository.class);
    final RepositoryKind proxyRepositoryKind = mock(RepositoryKind.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(proxyRepository);
    when(proxyRepository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(proxyRepository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(proxyRepository.getRepositoryKind()).thenReturn(proxyRepositoryKind);
    when(proxyRepositoryKind.isFacetAvailable(ProxyRepository.class)).thenReturn(true);
View Full Code Here

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry

  @Test
  public void shouldFailOnNonMaven2Repositories()
      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository repository = mock(Repository.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_1_CONTENT_CLASS);

    thrown.expect(IllegalArgumentException.class);
    new DefaultReleaseRemover(repositoryRegistry, targetRegistry, mock(Walker.class), MAVEN_2_CONTENT_CLASS)
        .removeReleases(new ReleaseRemovalRequest(REPO_ID, 1, null));
View Full Code Here

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry

  @Test
  public void shouldFailOnOutOfServiceRepositories()
      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);

    final Repository repository = mock(Repository.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(repository.getLocalStatus()).thenReturn(LocalStatus.OUT_OF_SERVICE);

    thrown.expect(IllegalArgumentException.class);
    new DefaultReleaseRemover(repositoryRegistry, targetRegistry, mock(Walker.class), MAVEN_2_CONTENT_CLASS)
View Full Code Here

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry

  @Test
  public void shouldFailOnGroupRepositories()
      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository repository = mock(Repository.class);
    final RepositoryKind repositoryKind = mock(RepositoryKind.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(repository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    when(repositoryKind.isFacetAvailable(GroupRepository.class)).thenReturn(true);
View Full Code Here

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry

  @Test
  public void shouldFailOnSnapshotRepositories()
      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository repository = mock(Repository.class);
    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
    final MavenRepository mavenRepository = mock(MavenRepository.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(repository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    when(repositoryKind.isFacetAvailable(GroupRepository.class)).thenReturn(false);
    when(repository.adaptToFacet(MavenRepository.class)).thenReturn(mavenRepository);
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.