Examples of NexusConfiguration


Examples of org.sonatype.nexus.configuration.application.NexusConfiguration

   */
  public Configuration loadAndUpgradeNexusConfiguration()
      throws IOException
  {
    try {
      NexusConfiguration nexusConfiguration;
      nexusConfiguration = TestContainer.getInstance().getPlexusContainer().lookup(NexusConfiguration.class);
      nexusConfiguration.loadConfiguration(true);
      return nexusConfiguration.getConfigurationModel();
    }
    catch (Exception e) {
      throw new IOException(e);
    }
  }
View Full Code Here

Examples of org.sonatype.nexus.configuration.application.NexusConfiguration

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

Examples of org.sonatype.nexus.configuration.application.NexusConfiguration

  {

    this.copyDefaultConfigToPlace();
    this.setupEmailConfig();

    NexusConfiguration nexusConfig = this.lookup(NexusConfiguration.class);
    nexusConfig.loadConfiguration(true);

    String username = "admin";

    PlexusResource resetEmailPR = this.lookup(PlexusResource.class, "UserResetPlexusResource");
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.