@Test public void getRepositoryGroupConfiguration() throws RepositoryException, URISyntaxException, IOException { MavenRepositoryGroup repositoryGroup = MavenRepositoryGroup.newLocalInstance("group1","group1",Paths.get("target/groups")); MavenManagedRepository repo1 = MavenManagedRepository.newLocalInstance( "test01", "My Test repo", Paths.get("target/repositories") ); MavenManagedRepository repo2 = MavenManagedRepository.newLocalInstance( "test02", "My Test repo", Paths.get("target/repositories") ); repositoryGroup.setDescription(repositoryGroup.getPrimaryLocale(), "Repository group"); repositoryGroup.setLayout("non-default"); IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); indexCreationFeature.setIndexPath( new URI(".index2") ); repositoryGroup.setName(repositoryGroup.getPrimaryLocale(), "Repo Group 1"); repositoryGroup.setMergedIndexTTL(1005); repositoryGroup.setSchedulingDefinition("0 0 04 ? * THU"); repositoryGroup.addRepository(repo1); repositoryGroup.addRepository(repo2); RepositoryGroupConfiguration cfg = provider.getRepositoryGroupConfiguration(repositoryGroup); assertEquals("group1", cfg.getId()); assertEquals(".index2", cfg.getMergedIndexPath()); assertEquals("0 0 04 ? * THU", cfg.getCronExpression()); assertEquals("Repo Group 1", cfg.getName()); assertEquals(1005, cfg.getMergedIndexTtl()); assertTrue(cfg.getRepositories().contains("test01")); assertTrue(cfg.getRepositories().contains("test02")); assertEquals(2, cfg.getRepositories().size()); }
@Override public RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException { if (repositoryGroup.getType() != RepositoryType.MAVEN) { throw new RepositoryException("The given repository group is not of MAVEN type"); } RepositoryGroupConfiguration cfg = new RepositoryGroupConfiguration(); cfg.setId(repositoryGroup.getId()); cfg.setName(repositoryGroup.getName()); if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); cfg.setMergedIndexPath( indexCreationFeature.getIndexPath().toString() ); } cfg.setMergedIndexTtl(repositoryGroup.getMergedIndexTTL()); cfg.setRepositories(repositoryGroup.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList())); cfg.setCronExpression(repositoryGroup.getSchedulingDefinition()); return cfg; }
MavenRepositoryProvider implements RepositoryProvider { @Override public RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException { if (repositoryGroup.getType() != RepositoryType.MAVEN) { throw new RepositoryException("The given repository group is not of MAVEN type"); } RepositoryGroupConfiguration cfg = new RepositoryGroupConfiguration(); cfg.setId(repositoryGroup.getId()); cfg.setName(repositoryGroup.getName()); if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); cfg.setMergedIndexPath( indexCreationFeature.getIndexPath().toString() ); } cfg.setMergedIndexTtl(repositoryGroup.getMergedIndexTTL()); cfg.setRepositories(repositoryGroup.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList())); cfg.setCronExpression(repositoryGroup.getSchedulingDefinition()); return cfg; } }
MavenRepositoryProvider implements RepositoryProvider { @Override public RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException { if (repositoryGroup.getType() != RepositoryType.MAVEN) { throw new RepositoryException("The given repository group is not of MAVEN type"); } RepositoryGroupConfiguration cfg = new RepositoryGroupConfiguration(); cfg.setId(repositoryGroup.getId()); cfg.setName(repositoryGroup.getName()); if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); cfg.setMergedIndexPath( indexCreationFeature.getIndexPath().toString() ); } cfg.setMergedIndexTtl(repositoryGroup.getMergedIndexTTL()); cfg.setRepositories(repositoryGroup.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList())); cfg.setCronExpression(repositoryGroup.getSchedulingDefinition()); return cfg; }  }
MavenRepositoryProvider implements RepositoryProvider { @Override public RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException { if (repositoryGroup.getType() != RepositoryType.MAVEN) { throw new RepositoryException("The given repository group is not of MAVEN type"); } RepositoryGroupConfiguration cfg = new RepositoryGroupConfiguration(); cfg.setId(repositoryGroup.getId()); cfg.setName(repositoryGroup.getName()); if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); cfg.setMergedIndexPath( indexCreationFeature.getIndexPath().toString() ); } cfg.setMergedIndexTtl(repositoryGroup.getMergedIndexTTL()); cfg.setRepositories(repositoryGroup.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList())); cfg.setCronExpression(repositoryGroup.getSchedulingDefinition()); return cfg; }  @Override Set<RepositoryType> provides(); @Override MavenManagedRepository createManagedInstance(String id, String name); MavenManagedRepository createManagedInstance(String id, String name, Path baseDir); @Override MavenRemoteRepository createRemoteInstance(String id, String name); MavenRemoteRepository createRemoteInstance(String id, String name, Path baseDir); @Override EditableRepositoryGroup createRepositoryGroup(String id, String name); MavenRepositoryGroup createRepositoryGroup(String id, String name, Path baseDir); @Override ManagedRepository createManagedInstance(ManagedRepositoryConfiguration cfg); @Override void updateManagedInstance(EditableManagedRepository repo, ManagedRepositoryConfiguration cfg); @Override ManagedRepository createStagingInstance(ManagedRepositoryConfiguration baseConfiguration); @Override RemoteRepository createRemoteInstance(RemoteRepositoryConfiguration cfg); @Override void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration cfg); @Override RepositoryGroup createRepositoryGroup(RepositoryGroupConfiguration configuration); @Override void updateRepositoryGroupInstance(EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration); @Override RemoteRepositoryConfiguration getRemoteConfiguration(RemoteRepository remoteRepository); @Override ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository); @Override RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup); ArchivaConfiguration getArchivaConfiguration(); void setArchivaConfiguration(ArchivaConfiguration archivaConfiguration); @Override void handle(Event event); }
MavenRepositoryProvider implements RepositoryProvider { @Override public RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException { if (repositoryGroup.getType() != RepositoryType.MAVEN) { throw new RepositoryException("The given repository group is not of MAVEN type"); } RepositoryGroupConfiguration cfg = new RepositoryGroupConfiguration(); cfg.setId(repositoryGroup.getId()); cfg.setName(repositoryGroup.getName()); if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); cfg.setMergedIndexPath( indexCreationFeature.getIndexPath().toString() ); } cfg.setMergedIndexTtl(repositoryGroup.getMergedIndexTTL()); cfg.setRepositories(repositoryGroup.getRepositories().stream().map(r -> r.getId()).collect(Collectors.toList())); cfg.setCronExpression(repositoryGroup.getSchedulingDefinition()); return cfg; }  @Override Set<RepositoryType> provides(); @Override MavenManagedRepository createManagedInstance(String id, String name); MavenManagedRepository createManagedInstance(String id, String name, Path baseDir); @Override MavenRemoteRepository createRemoteInstance(String id, String name); MavenRemoteRepository createRemoteInstance(String id, String name, Path baseDir); @Override EditableRepositoryGroup createRepositoryGroup(String id, String name); MavenRepositoryGroup createRepositoryGroup(String id, String name, Path baseDir); @Override ManagedRepository createManagedInstance(ManagedRepositoryConfiguration cfg); @Override void updateManagedInstance(EditableManagedRepository repo, ManagedRepositoryConfiguration cfg); @Override ManagedRepository createStagingInstance(ManagedRepositoryConfiguration baseConfiguration); @Override RemoteRepository createRemoteInstance(RemoteRepositoryConfiguration cfg); @Override void updateRemoteInstance(EditableRemoteRepository repo, RemoteRepositoryConfiguration cfg); @Override RepositoryGroup createRepositoryGroup(RepositoryGroupConfiguration configuration); @Override void updateRepositoryGroupInstance(EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration); @Override RemoteRepositoryConfiguration getRemoteConfiguration(RemoteRepository remoteRepository); @Override ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository); @Override RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup); ArchivaConfiguration getArchivaConfiguration(); void setArchivaConfiguration(ArchivaConfiguration archivaConfiguration); @Override void handle(Event event);  }