@Test public void createManagedInstance( ) throws Exception { ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration( ); repo.setId("testm001"); repo.setName("Managed Test Repo 001"); repo.setDescription( "This is a managed test" ); repo.setRetentionPeriod( 37 ); repoLocation = Files.createTempDirectory( "test-repo-001"); repo.setLocation( repoLocation.toAbsolutePath().toString() ); repo.setSnapshots( true ); repo.setReleases( true ); repo.setRefreshCronExpression( "4 0 0 ? * TUE" ); repo.setScanned( true ); repo.setBlockRedeployments( true ); repo.setDeleteReleasedSnapshots( true ); repo.setRetentionCount( 33 ); repo.setSkipPackedIndexCreation( true ); repo.setStageRepoNeeded( true ); repo.setIndexDir( "testmanaged/.index" ); repo.setLayout( "maven2" ); repo.setType( RepositoryType.MAVEN.toString() ); ManagedRepository mr = provider.createManagedInstance( repo ); assertNotNull(mr.getLocation()); String repoUri = repoLocation.toUri().toString(); assertTrue(Files.exists(repoLocation)); repoUri = repoUri.substring( 0, repoUri.length()-1 ); assertEquals(repoUri, mr.getLocation().toString()); assertEquals("This is a managed test", mr.getDescription()); assertEquals("Managed Test Repo 001", mr.getName()); assertEquals(2, mr.getActiveReleaseSchemes().size()); assertTrue( mr.getActiveReleaseSchemes().contains( ReleaseScheme.RELEASE )); assertTrue( mr.getActiveReleaseSchemes().contains( ReleaseScheme.SNAPSHOT)); assertEquals("testm001", mr.getId()); assertTrue(mr.blocksRedeployments()); assertEquals("4 0 0 ? * TUE", mr.getSchedulingDefinition()); assertTrue(mr.isScanned()); ArtifactCleanupFeature artifactCleanupFeature = mr.getFeature( ArtifactCleanupFeature.class ).get(); assertEquals( Period.ofDays( 37), artifactCleanupFeature.getRetentionPeriod()); assertTrue(artifactCleanupFeature.isDeleteReleasedSnapshots()); assertEquals(33, artifactCleanupFeature.getRetentionCount()); IndexCreationFeature indexCreationFeature = mr.getFeature( IndexCreationFeature.class ).get(); assertNotNull(indexCreationFeature.getIndexPath()); assertEquals("testmanaged/.index", indexCreationFeature.getIndexPath().toString()); assertFalse(indexCreationFeature.getIndexPath().isAbsolute()); assertTrue(indexCreationFeature.isSkipPackedIndexCreation()); StagingRepositoryFeature stagingRepositoryFeature = mr.getFeature( StagingRepositoryFeature.class ).get(); assertTrue(stagingRepositoryFeature.isStageRepoNeeded()); assertNull(stagingRepositoryFeature.getStagingRepository()); }
@Override public MavenManagedRepository createManagedInstance(String id, String name) { return createManagedInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); }
MavenRepositoryProvider implements RepositoryProvider { @Override public MavenManagedRepository createManagedInstance(String id, String name) { return createManagedInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); } }
MavenRepositoryProvider implements RepositoryProvider { @Override public MavenManagedRepository createManagedInstance(String id, String name) { return createManagedInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); }  }
MavenRepositoryProvider implements RepositoryProvider { @Override public MavenManagedRepository createManagedInstance(String id, String name) { return createManagedInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); }  @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 MavenManagedRepository createManagedInstance(String id, String name) { return createManagedInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); }  @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);  }