@Test public void createRemoteInstance( ) throws Exception { RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration( ); repo.setUsername("testuser001"); repo.setPassword( "pwd0000abc" ); repo.setCheckPath( "test/check.html" ); repo.setTimeout( 50 ); repo.setUrl( "https: repo.setDownloadRemoteIndex( true ); repo.setDownloadRemoteIndexOnStartup( true ); Map<String,String> header = new HashMap<>( ); header.put("header1","value1"); header.put("header2","value2"); repo.setExtraHeaders( header ); Map<String,String> params = new HashMap<>( ); params.put("param1","pval1"); params.put("param2","pval2"); repo.setExtraParameters( params ); repo.setRefreshCronExpression( "0 1 07 ? * MON" ); repo.setRemoteDownloadTimeout( 333 ); repo.setRemoteIndexUrl( "testremote/.index" ); repo.setDescription( "This is a test" ); repo.setId( "test001" ); repo.setName( "Remote Test Repo 001" ); repo.setIndexDir( "testindex/.index" ); repo.setLayout( "maven2" ); repo.setType( RepositoryType.MAVEN.toString() ); repo.setIndexDir( "local/.index" ); RemoteRepository mr = provider.createRemoteInstance( repo ); assertEquals("test001", mr.getId()); assertEquals("This is a test", mr.getDescription()); assertNotNull(mr.getLocation()); assertEquals("https: assertEquals("Remote Test Repo 001", mr.getName()); assertEquals("test001", mr.getId()); assertEquals("0 1 07 ? * MON", mr.getSchedulingDefinition()); assertEquals(50, mr.getTimeout().get( ChronoUnit.SECONDS )); assertTrue(mr.isScanned()); assertNotNull(mr.getLoginCredentials()); assertTrue(mr.getLoginCredentials() instanceof PasswordCredentials ); PasswordCredentials creds = (PasswordCredentials) mr.getLoginCredentials(); assertEquals("testuser001", creds.getUsername()); assertEquals("pwd0000abc", new String(creds.getPassword())); assertEquals("value1", mr.getExtraHeaders().get("header1")); assertEquals("pval2", mr.getExtraParameters().get("param2")); assertEquals( "maven2", mr.getLayout()); try { ArtifactCleanupFeature artifactCleanupFeature = mr.getFeature( ArtifactCleanupFeature.class ).get( ); throw new Exception("artifactCleanupFeature should not be available"); } catch ( UnsupportedFeatureException e ) { } IndexCreationFeature indexCreationFeature = mr.getFeature( IndexCreationFeature.class ).get( ); assertEquals("local/.index", indexCreationFeature.getIndexPath().toString()); try { StagingRepositoryFeature stagingRepositoryFeature = mr.getFeature( StagingRepositoryFeature.class ).get( ); throw new Exception("stagingRepositoryFeature should not be available"); } catch (UnsupportedFeatureException e) { } RemoteIndexFeature remoteIndexFeature = mr.getFeature( RemoteIndexFeature.class ).get(); assertNull(remoteIndexFeature.getProxyId()); }
@Override public MavenRemoteRepository createRemoteInstance(String id, String name) { return createRemoteInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); }
MavenRepositoryProvider implements RepositoryProvider { @Override public MavenRemoteRepository createRemoteInstance(String id, String name) { return createRemoteInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); } }
MavenRepositoryProvider implements RepositoryProvider { @Override public MavenRemoteRepository createRemoteInstance(String id, String name) { return createRemoteInstance(id, name, archivaConfiguration.getRemoteRepositoryBaseDir()); }  }
MavenRepositoryProvider implements RepositoryProvider { @Override public MavenRemoteRepository createRemoteInstance(String id, String name) { return createRemoteInstance(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 MavenRemoteRepository createRemoteInstance(String id, String name) { return createRemoteInstance(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);  }