@Test public void testStaleLocalMetadataCopyGetsDeletedBeforeMergeWhenMetadataIsNotCurrentlyPresentInRemoteRepo() throws Exception { MergeableMetadata metadata = new MergeableMetadata() { public Metadata setFile( File file ) { return this; } public String getVersion() { return ""; } public String getType() { return "test.properties"; } public Nature getNature() { return Nature.RELEASE; } public String getGroupId() { return "org"; } public File getFile() { return null; } public String getArtifactId() { return "aether"; } public Metadata setProperties( Map<String, String> properties ) { return this; } public Map<String, String> getProperties() { return Collections.emptyMap(); } public String getProperty( String key, String defaultValue ) { return defaultValue; } public void merge( File current, File result ) throws RepositoryException { Properties props = new Properties(); try { if ( current.isFile() ) { TestFileUtils.readProps( current, props ); } props.setProperty( "new", "value" ); TestFileUtils.writeProps( result, props ); } catch ( IOException e ) { throw new RepositoryException( e.getMessage(), e ); } } public boolean isMerged() { return false; } }; connectorProvider.setConnector( new RepositoryConnector() { public void put( Collection<? extends ArtifactUpload> artifactUploads, Collection<? extends MetadataUpload> metadataUploads ) { } public void get( Collection<? extends ArtifactDownload> artifactDownloads, Collection<? extends MetadataDownload> metadataDownloads ) { if ( metadataDownloads != null ) { for ( MetadataDownload download : metadataDownloads ) { download.setException( new MetadataNotFoundException( download.getMetadata(), null, null ) ); } } } public void close() { } } ); request.addMetadata( metadata ); File metadataFile = new File( session.getLocalRepository().getBasedir(), session.getLocalRepositoryManager().getPathForRemoteMetadata( metadata, request.getRepository(), "" ) ); Properties props = new Properties(); props.setProperty( "old", "value" ); TestFileUtils.writeProps( metadataFile, props ); deployer.deploy( session, request ); props = new Properties(); TestFileUtils.readProps( metadataFile, props ); assertNull( props.toString(), props.get( "old" ) ); }
public DeployResult deploy( RepositorySystemSession session, DeployRequest request ) throws DeploymentException { try { Utils.checkOffline( session, offlineController, request.getRepository() ); } catch ( RepositoryOfflineException e ) { throw new DeploymentException( "Cannot deploy while " + request.getRepository().getId() + " (" + request.getRepository().getUrl() + ") is in offline mode", e ); } SyncContext syncContext = syncContextFactory.newInstance( session, false ); try { return deploy( syncContext, session, request ); } finally { syncContext.close(); } }
DefaultDeployer implements Deployer, Service { public DeployResult deploy( RepositorySystemSession session, DeployRequest request ) throws DeploymentException { try { Utils.checkOffline( session, offlineController, request.getRepository() ); } catch ( RepositoryOfflineException e ) { throw new DeploymentException( "Cannot deploy while " + request.getRepository().getId() + " (" + request.getRepository().getUrl() + ") is in offline mode", e ); } SyncContext syncContext = syncContextFactory.newInstance( session, false ); try { return deploy( syncContext, session, request ); } finally { syncContext.close(); } } }
DefaultDeployer implements Deployer, Service { public DeployResult deploy( RepositorySystemSession session, DeployRequest request ) throws DeploymentException { try { Utils.checkOffline( session, offlineController, request.getRepository() ); } catch ( RepositoryOfflineException e ) { throw new DeploymentException( "Cannot deploy while " + request.getRepository().getId() + " (" + request.getRepository().getUrl() + ") is in offline mode", e ); } SyncContext syncContext = syncContextFactory.newInstance( session, false ); try { return deploy( syncContext, session, request ); } finally { syncContext.close(); } } DefaultDeployer(); @Inject  DefaultDeployer( FileProcessor fileProcessor, RepositoryEventDispatcher repositoryEventDispatcher,
                     RepositoryConnectorProvider repositoryConnectorProvider,
                     RemoteRepositoryManager remoteRepositoryManager, UpdateCheckManager updateCheckManager,
                     Set<MetadataGeneratorFactory> metadataFactories, SyncContextFactory syncContextFactory,
                     OfflineController offlineController, LoggerFactory loggerFactory ); }
DefaultDeployer implements Deployer, Service { public DeployResult deploy( RepositorySystemSession session, DeployRequest request ) throws DeploymentException { try { Utils.checkOffline( session, offlineController, request.getRepository() ); } catch ( RepositoryOfflineException e ) { throw new DeploymentException( "Cannot deploy while " + request.getRepository().getId() + " (" + request.getRepository().getUrl() + ") is in offline mode", e ); } SyncContext syncContext = syncContextFactory.newInstance( session, false ); try { return deploy( syncContext, session, request ); } finally { syncContext.close(); } } DefaultDeployer(); @Inject  DefaultDeployer( FileProcessor fileProcessor, RepositoryEventDispatcher repositoryEventDispatcher,
                     RepositoryConnectorProvider repositoryConnectorProvider,
                     RemoteRepositoryManager remoteRepositoryManager, UpdateCheckManager updateCheckManager,
                     Set<MetadataGeneratorFactory> metadataFactories, SyncContextFactory syncContextFactory,
                     OfflineController offlineController, LoggerFactory loggerFactory ); void initService( ServiceLocator locator ); DefaultDeployer setLoggerFactory( LoggerFactory loggerFactory ); DefaultDeployer setFileProcessor( FileProcessor fileProcessor ); DefaultDeployer setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher ); DefaultDeployer setRepositoryConnectorProvider( RepositoryConnectorProvider repositoryConnectorProvider ); DefaultDeployer setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager ); DefaultDeployer setUpdateCheckManager( UpdateCheckManager updateCheckManager ); DefaultDeployer addMetadataGeneratorFactory( MetadataGeneratorFactory factory ); DefaultDeployer setMetadataGeneratorFactories( Collection<MetadataGeneratorFactory> metadataFactories ); DefaultDeployer setSyncContextFactory( SyncContextFactory syncContextFactory ); DefaultDeployer setOfflineController( OfflineController offlineController ); DeployResult deploy( RepositorySystemSession session, DeployRequest request ); }
DefaultDeployer implements Deployer, Service { public DeployResult deploy( RepositorySystemSession session, DeployRequest request ) throws DeploymentException { try { Utils.checkOffline( session, offlineController, request.getRepository() ); } catch ( RepositoryOfflineException e ) { throw new DeploymentException( "Cannot deploy while " + request.getRepository().getId() + " (" + request.getRepository().getUrl() + ") is in offline mode", e ); } SyncContext syncContext = syncContextFactory.newInstance( session, false ); try { return deploy( syncContext, session, request ); } finally { syncContext.close(); } } DefaultDeployer(); @Inject  DefaultDeployer( FileProcessor fileProcessor, RepositoryEventDispatcher repositoryEventDispatcher,
                     RepositoryConnectorProvider repositoryConnectorProvider,
                     RemoteRepositoryManager remoteRepositoryManager, UpdateCheckManager updateCheckManager,
                     Set<MetadataGeneratorFactory> metadataFactories, SyncContextFactory syncContextFactory,
                     OfflineController offlineController, LoggerFactory loggerFactory ); void initService( ServiceLocator locator ); DefaultDeployer setLoggerFactory( LoggerFactory loggerFactory ); DefaultDeployer setFileProcessor( FileProcessor fileProcessor ); DefaultDeployer setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher ); DefaultDeployer setRepositoryConnectorProvider( RepositoryConnectorProvider repositoryConnectorProvider ); DefaultDeployer setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager ); DefaultDeployer setUpdateCheckManager( UpdateCheckManager updateCheckManager ); DefaultDeployer addMetadataGeneratorFactory( MetadataGeneratorFactory factory ); DefaultDeployer setMetadataGeneratorFactories( Collection<MetadataGeneratorFactory> metadataFactories ); DefaultDeployer setSyncContextFactory( SyncContextFactory syncContextFactory ); DefaultDeployer setOfflineController( OfflineController offlineController ); DeployResult deploy( RepositorySystemSession session, DeployRequest request );  }