Examples of Maven2GroupRepositoryTemplate


Examples of org.sonatype.nexus.templates.repository.maven.Maven2GroupRepositoryTemplate

  }

  private Repository buildGroupRepository(String repoId)
      throws Exception
  {
    Maven2GroupRepositoryTemplate template =
        (Maven2GroupRepositoryTemplate) getRepositoryTemplates().getTemplates(
            Maven2GroupRepositoryTemplate.class).pick();

    template.getConfigurableRepository().setIndexable(false);
    template.getConfigurableRepository().setId(repoId);

    return template.create();
  }
View Full Code Here

Examples of org.sonatype.nexus.templates.repository.maven.Maven2GroupRepositoryTemplate

    // this one should pass, these are the default
    createRepository(repoId + 6, false);
  }

  protected RepositoryTemplate getTemplate() {
    Maven2GroupRepositoryTemplate template =
        (Maven2GroupRepositoryTemplate) getRepositoryTemplates().getTemplates(
            Maven2GroupRepositoryTemplate.class).pick();

    return template;
  }
View Full Code Here

Examples of org.sonatype.nexus.templates.repository.maven.Maven2GroupRepositoryTemplate

      throws Exception
  {

    String groupId = "group-id";

    Maven2GroupRepositoryTemplate template =
        (Maven2GroupRepositoryTemplate) getRepositoryTemplates()
            .getTemplates(Maven2GroupRepositoryTemplate.class).pick();

    template.getConfigurableRepository().setId(groupId);
    template.getConfigurableRepository().setName("group-name");
    // Assert.assertEquals( "group-name", group.getName() );
    template.getConfigurableRepository().setExposed(true);
    template.getConfigurableRepository().setLocalStatus(LocalStatus.IN_SERVICE);
    template.getExternalConfiguration(true).addMemberRepositoryId("central");

    template.create();

    boolean found = false;
    // verify nexus config in memory
    for (CRepository cRepo : this.nexusConfiguration.getConfigurationModel().getRepositories()) {
      if (groupId.equals(cRepo.getId())) {
        System.out.println("ummmm");
        found = true;
        // make sure something is there, there are already UT, to validate the rest
        Assert.assertEquals("group-name", cRepo.getName());
        // check the members (they are in the external config)
        Xpp3Dom dom = (Xpp3Dom) cRepo.getExternalConfiguration();
        Xpp3Dom memberDom = dom.getChild("memberRepositories");
        Assert.assertEquals(1, memberDom.getChildCount());
        Assert.assertEquals("central", memberDom.getChild(0).getValue());
      }
    }
    Assert.assertTrue("Group Repo is not in memory.", found);

    // reload the config and see if the repo is still there
    this.nexusConfiguration.loadConfiguration(true);

    found = false;
    // verify nexus config in memory
    for (CRepository cRepo : this.nexusConfiguration.getConfigurationModel().getRepositories()) {
      if (groupId.equals(cRepo.getId())) {
        found = true;
        // make sure something is there, there are already UT, to validate the rest
        Assert.assertEquals("group-name", template.getConfigurableRepository().getName());
      }
    }
    Assert.assertTrue("Group Repo is not in file.", found);
  }
View Full Code Here

Examples of org.sonatype.nexus.templates.repository.maven.Maven2GroupRepositoryTemplate

  public void testCreateRepoWithInvalidMember()
      throws Exception
  {
    String groupId = "group-id";

    Maven2GroupRepositoryTemplate template =
        (Maven2GroupRepositoryTemplate) getRepositoryTemplates()
            .getTemplates(Maven2GroupRepositoryTemplate.class).pick();

    template.getConfigurableRepository().setId(groupId);
    template.getConfigurableRepository().setName("group-name");
    // Assert.assertEquals( "group-name", group.getName() );
    template.getConfigurableRepository().setExposed(true);
    template.getConfigurableRepository().setLocalStatus(LocalStatus.IN_SERVICE);
    // validation does NOT happen on the fly!
    template.getExternalConfiguration(true).addMemberRepositoryId("INVALID-REPO-ID");

    try {
      template.create();
      Assert.fail("Expected NoSuchRepositoryException");
    }
    catch (ConfigurationException e) {
      // expected
    }
View Full Code Here

Examples of org.sonatype.nexus.templates.repository.maven.Maven2GroupRepositoryTemplate

  public void testCreateWithNoId()
      throws Exception
  {
    String groupId = null;

    Maven2GroupRepositoryTemplate template =
        (Maven2GroupRepositoryTemplate) getRepositoryTemplates()
            .getTemplates(Maven2GroupRepositoryTemplate.class).pick();

    template.getConfigurableRepository().setId(groupId);
    template.getConfigurableRepository().setName("group-name");
    // Assert.assertEquals( "group-name", group.getName() );
    template.getConfigurableRepository().setExposed(true);
    template.getConfigurableRepository().setLocalStatus(LocalStatus.IN_SERVICE);
    template.getExternalConfiguration(true).addMemberRepositoryId("central");

    try {
      template.create();
      Assert.fail("expected ConfigurationException");
    }
    catch (ConfigurationException e) {
      // expected
    }
View Full Code Here

Examples of org.sonatype.nexus.templates.repository.maven.Maven2GroupRepositoryTemplate

  public void testCreateWithEmptyId()
      throws Exception
  {
    String groupId = "";

    Maven2GroupRepositoryTemplate template =
        (Maven2GroupRepositoryTemplate) getRepositoryTemplates()
            .getTemplates(Maven2GroupRepositoryTemplate.class).pick();

    template.getConfigurableRepository().setId(groupId);
    template.getConfigurableRepository().setName("group-name");
    // Assert.assertEquals( "group-name", group.getName() );
    template.getConfigurableRepository().setExposed(true);
    template.getConfigurableRepository().setLocalStatus(LocalStatus.IN_SERVICE);
    template.getExternalConfiguration(true).addMemberRepositoryId("central");

    try {
      template.create();
      Assert.fail("expected ConfigurationException");
    }
    catch (ConfigurationException e) {
      // expected
    }
View Full Code Here

Examples of org.sonatype.nexus.templates.repository.maven.Maven2GroupRepositoryTemplate

      templates.add(new Maven1ProxyRepositoryTemplate(this, "maven1_proxy_snapshot",
          "Maven1 (proxy, snapshot)", RepositoryPolicy.SNAPSHOT));

      templates.add(new Maven1GroupRepositoryTemplate(this, "maven1_group", "Maven1 (group)"));

      templates.add(new Maven2GroupRepositoryTemplate(this, DEFAULT_GROUP, "Maven2 (group)"));
    }
    catch (Exception e) {
      // will not happen
    }
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.