private boolean isInterestingArtifactEvent( final RepositoryEvent event ) { return interestingArtifactEvents.contains( event.getType() ); }
private boolean isInterestingArtifactEvent( final RepositoryEvent event ) { return interestingArtifactEvents.contains( event.getType() ); }
@Override protected boolean _handle(RepositoryEvent repositoryEvent) { if (repositoryEvent.getType() == RepositoryEvent.EventType.ARTIFACT_DOWNLOADING) { currentEventStartTimeInNanos = System.nanoTime(); } else if (repositoryEvent.getType() == RepositoryEvent.EventType.ARTIFACT_DOWNLOADED) { long durationInNanos = System.nanoTime() - currentEventStartTimeInNanos; artifactDownloadDurationInNanos += durationInNanos; print(repositoryEvent, durationInNanos); currentEventStartTimeInNanos = 0; } if (repositoryEvent.getType() == RepositoryEvent.EventType.METADATA_DOWNLOADING) { currentEventStartTimeInNanos = System.nanoTime(); } else if (repositoryEvent.getType() == RepositoryEvent.EventType.METADATA_DOWNLOADED) { long durationInNanos = System.nanoTime() - currentEventStartTimeInNanos; artifactDownloadDurationInNanos += durationInNanos; print(repositoryEvent, durationInNanos); currentEventStartTimeInNanos = 0; } else { } return true; }
private void print(RepositoryEvent repositoryEvent, long durationInNanos) { reporter.print(repositoryEvent.getArtifact().toString() + "-" + repositoryEvent.getType() + "-" + durationInNanos + "nanos"); } }
/** * From Benjamin Bentmann: * Aether artifact resolution can succeed or fail, the event is fired in * both cases to signal the end of the resolution. * Checking the artifact file is another way to detect failure/success, by * definition, an artifact is considered resolved if and only if it has a file. */ @TestAccessible ArtifactOperationDTO resolveOperationType( final RepositoryEvent event ) { ArtifactOperationDTO result; if( null == event.getFile() ) { for( Exception e : event.getExceptions() ) { log.debug( "Artifact not found", e ); } result = ArtifactOperationDTO.NOT_FOUND; } else { result = ArtifactOperationDTO.valueOf( event.getType().name().substring( 9 ) ); } return result; }
/** * From Benjamin Bentmann: * Aether artifact resolution can succeed or fail, the event is fired in * both cases to signal the end of the resolution. * Checking the artifact file is another way to detect failure/success, by * definition, an artifact is considered resolved if and only if it has a file. */ @TestAccessible ArtifactOperationDTO resolveOperationType( final RepositoryEvent event ) { ArtifactOperationDTO result; if( null == event.getFile() ) { for( Exception e : event.getExceptions() ) { log.debug( "Artifact not found", e ); } result = ArtifactOperationDTO.NOT_FOUND; } else { result = ArtifactOperationDTO.valueOf( event.getType().name().substring( 9 ) ); } return result; }