Examples of DefaultCRepository


Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    attributeStorage = lookup(AttributeStorage.class, "ls");

    repository = (M2Repository) lookup(Repository.class, "maven2");

    CRepository repoConf = new DefaultCRepository();

    repoConf.setProviderRole(Repository.class.getName());
    repoConf.setProviderHint("maven2");
    repoConf.setId("dummy");

    repoConf.setLocalStorage(new CLocalStorage());
    repoConf.getLocalStorage().setProvider("file");
    localStorageDirectory = new File(getBasedir(), "target/test-reposes/repo1");
    repoConf.getLocalStorage().setUrl(localStorageDirectory.toURI().toURL().toString());

    Xpp3Dom exRepo = new Xpp3Dom("externalConfiguration");
    repoConf.setExternalConfiguration(exRepo);
    M2RepositoryConfiguration exRepoConf = new M2RepositoryConfiguration(exRepo);
    exRepoConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);
    exRepoConf.setChecksumPolicy(ChecksumPolicy.STRICT_IF_EXISTS);

    FileUtils.deleteDirectory(new File(localStorageDirectory, ".nexus/attributes"));
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    super(provider, id, description, new Maven2ContentClass(), MavenShadowRepository.class, null);
  }

  @Override
  protected CRepositoryCoreConfiguration initCoreConfiguration() {
    CRepository repo = new DefaultCRepository();

    repo.setId("");
    repo.setName("");

    repo.setProviderRole(ShadowRepository.class.getName());
    repo.setProviderHint("m1-m2-shadow");

    Xpp3Dom ex = new Xpp3Dom(DefaultCRepository.EXTERNAL_CONFIGURATION_NODE_NAME);
    repo.setExternalConfiguration(ex);

    M2LayoutedM1ShadowRepositoryConfiguration exConf = new M2LayoutedM1ShadowRepositoryConfiguration(ex);
    repo.externalConfigurationImple = exConf;

    repo.setWritePolicy(RepositoryWritePolicy.READ_ONLY.name());

    CRepositoryCoreConfiguration result =
        new CRepositoryCoreConfiguration(
            getTemplateProvider().getApplicationConfiguration(),
            repo,
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    super(provider, id, description, new Maven1ContentClass(), MavenProxyRepository.class, repositoryPolicy);
  }

  @Override
  protected CRepositoryCoreConfiguration initCoreConfiguration() {
    CRepository repo = new DefaultCRepository();

    repo.setId("");
    repo.setName("");

    repo.setProviderRole(Repository.class.getName());
    repo.setProviderHint("maven1");

    repo.setRemoteStorage(new CRemoteStorage());
    repo.getRemoteStorage().setProvider(getTemplateProvider().getRemoteProviderHintFactory().getDefaultHttpRoleHint());
    repo.getRemoteStorage().setUrl("http://some-remote-repository/repo-root");

    Xpp3Dom ex = new Xpp3Dom(DefaultCRepository.EXTERNAL_CONFIGURATION_NODE_NAME);
    repo.setExternalConfiguration(ex);

    M1RepositoryConfiguration exConf = new M1RepositoryConfiguration(ex);
    // huh? see initConfig classes
    if (getRepositoryPolicy() != null) {
      exConf.setRepositoryPolicy(getRepositoryPolicy());
    }

    repo.externalConfigurationImple = exConf;

    repo.setWritePolicy(RepositoryWritePolicy.READ_ONLY.name());
    repo.setNotFoundCacheActive(true);
    repo.setNotFoundCacheTTL(1440);

    if (exConf.getRepositoryPolicy() != null && exConf.getRepositoryPolicy() == RepositoryPolicy.SNAPSHOT) {
      exConf.setArtifactMaxAge(1440);
    }
    else {
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    }

    groupRepo = (M2GroupRepository) getContainer().lookup(GroupRepository.class, "maven2");

    CRepository repoGroupConf = new DefaultCRepository();

    repoGroupConf.setProviderRole(GroupRepository.class.getName());
    repoGroupConf.setProviderHint("maven2");
    repoGroupConf.setId("test");

    repoGroupConf.setLocalStorage(new CLocalStorage());
    repoGroupConf.getLocalStorage().setProvider("file");

    Xpp3Dom exGroupRepo = new Xpp3Dom("externalConfiguration");
    repoGroupConf.setExternalConfiguration(exGroupRepo);
    M2GroupRepositoryConfiguration exGroupRepoConf = new M2GroupRepositoryConfiguration(exGroupRepo);
    exGroupRepoConf.setMemberRepositoryIds(testgroup);
    exGroupRepoConf.setMergeMetadata(true);

    groupRepo.configure(repoGroupConf);
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

  public void testExpireNFCOnUpdate()
      throws Exception
  {
    M2Repository oldRepository = (M2Repository)this.lookup(Repository.class, "maven2");

    CRepository cRepo = new DefaultCRepository();
    cRepo.setId("test-repo");
    cRepo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    cRepo.setNotFoundCacheTTL(1);
    cRepo.setLocalStorage(new CLocalStorage());
    cRepo.getLocalStorage().setProvider("file");
    cRepo.setProviderRole(Repository.class.getName());
    cRepo.setProviderHint("maven2");

    Xpp3Dom ex = new Xpp3Dom("externalConfiguration");
    cRepo.setExternalConfiguration(ex);
    M2RepositoryConfiguration extConf = new M2RepositoryConfiguration(ex);
    extConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);

    oldRepository.configure(cRepo);

    oldRepository.getNotFoundCache().put("test-path", "test-object");

    // make sure the item is in NFC
    Assert.assertTrue(oldRepository.getNotFoundCache().contains("test-path"));

    // change config
    cRepo.setNotFoundCacheTTL(2);

    oldRepository.configure(cRepo);

    // make sure the item is NOT in NFC
    Assert.assertFalse(oldRepository.getNotFoundCache().contains("test-path"));
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

  public void testExpireNFCOnUpdateWithNFCDisabled()
      throws Exception
  {
    M2Repository oldRepository = (M2Repository)this.lookup(Repository.class, "maven2");

    CRepository cRepo = new DefaultCRepository();
    cRepo.setId("test-repo");
    cRepo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    cRepo.setNotFoundCacheTTL(1);
    cRepo.setLocalStorage(new CLocalStorage());
    cRepo.getLocalStorage().setProvider("file");
    Xpp3Dom ex = new Xpp3Dom("externalConfiguration");
    cRepo.setExternalConfiguration(ex);
    M2RepositoryConfiguration extConf = new M2RepositoryConfiguration(ex);
    extConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);
    cRepo.setProviderRole(Repository.class.getName());
    cRepo.setProviderHint("maven2");

    oldRepository.configure(cRepo);

    oldRepository.getNotFoundCache().put("test-path", "test-object");
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

        .getConfiguration(forWrite);
  }

  @Override
  protected CRepositoryCoreConfiguration initCoreConfiguration() {
    CRepository repo = new DefaultCRepository();

    repo.setId("");
    repo.setName("");

    repo.setProviderRole(ShadowRepository.class.getName());
    repo.setProviderHint("m2-m1-shadow");

    Xpp3Dom ex = new Xpp3Dom(DefaultCRepository.EXTERNAL_CONFIGURATION_NODE_NAME);
    repo.setExternalConfiguration(ex);

    M1LayoutedM2ShadowRepositoryConfiguration exConf = new M1LayoutedM2ShadowRepositoryConfiguration(ex);
    repo.externalConfigurationImple = exConf;

    repo.setWritePolicy(RepositoryWritePolicy.READ_ONLY.name());

    CRepositoryCoreConfiguration result =
        new CRepositoryCoreConfiguration(
            getTemplateProvider().getApplicationConfiguration(),
            repo,
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

      throws Exception
  {

    M2Repository repository = (M2Repository) this.lookup(Repository.class, "maven2");

    CRepository cRepo = new DefaultCRepository();
    cRepo.setId("test-repo");
    cRepo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    cRepo.setNotFoundCacheTTL(1);
    cRepo.setLocalStorage(new CLocalStorage());
    cRepo.getLocalStorage().setProvider("file");
    cRepo.setProviderRole(Repository.class.getName());
    cRepo.setProviderHint("maven2");

    Xpp3Dom ex = new Xpp3Dom("externalConfiguration");
    cRepo.setExternalConfiguration(ex);
    M2RepositoryConfiguration extConf = new M2RepositoryConfiguration(ex);
    extConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);

    repository.configure(cRepo);

    Assert.assertNotNull(repository.getLocalUrl());
    Assert.assertNull(cRepo.getLocalStorage().getUrl());

  }
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

  {
    super.setUp();

    repository = (M2Repository) lookup(Repository.class, "maven2");

    CRepository repoConf = new DefaultCRepository();

    repoConf.setProviderRole(Repository.class.getName());
    repoConf.setProviderHint("maven2");
    repoConf.setId("repo");
    repoConf.setName("repo");
    Xpp3Dom ex = new Xpp3Dom("externalConfiguration");
    repoConf.setExternalConfiguration(ex);

    repository.configure(repoConf);

    repositoryItemUidAttributeManager = lookup(RepositoryItemUidAttributeManager.class);
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

        forWrite);
  }

  @Override
  protected CRepositoryCoreConfiguration initCoreConfiguration() {
    CRepository repo = new DefaultCRepository();

    repo.setId("");
    repo.setName("");

    repo.setProviderRole(GroupRepository.class.getName());
    repo.setProviderHint("maven2");

    // groups should not participate in searches
    repo.setSearchable(false);

    Xpp3Dom ex = new Xpp3Dom(DefaultCRepository.EXTERNAL_CONFIGURATION_NODE_NAME);
    repo.setExternalConfiguration(ex);

    M2GroupRepositoryConfiguration exConf = new M2GroupRepositoryConfiguration(ex);
    repo.externalConfigurationImple = exConf;

    repo.setWritePolicy(RepositoryWritePolicy.READ_ONLY.name());

    CRepositoryCoreConfiguration result =
        new CRepositoryCoreConfiguration(getTemplateProvider().getApplicationConfiguration(), repo,
            new CRepositoryExternalConfigurationHolderFactory<M2GroupRepositoryConfiguration>()
            {
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.