Class TestRepositorySystemSession

java.lang.Object
org.eclipse.aether.internal.test.util.TestRepositorySystemSession
All Implemented Interfaces:
org.eclipse.aether.RepositorySystemSession

public final class TestRepositorySystemSession extends Object implements org.eclipse.aether.RepositorySystemSession
Test utility to create root sessions.
  • Constructor Details

  • Method Details

    • isOffline

      public boolean isOffline()
      Specified by:
      isOffline in interface org.eclipse.aether.RepositorySystemSession
    • setOffline

      public TestRepositorySystemSession setOffline(boolean offline)
      Controls whether the repository system operates in offline mode and avoids/refuses any access to remote repositories.
      Parameters:
      offline - true if the repository system is in offline mode, false otherwise.
      Returns:
      This session for chaining, never null.
    • isIgnoreArtifactDescriptorRepositories

      Specified by:
      isIgnoreArtifactDescriptorRepositories in interface org.eclipse.aether.RepositorySystemSession
    • setIgnoreArtifactDescriptorRepositories

      public TestRepositorySystemSession setIgnoreArtifactDescriptorRepositories(boolean ignoreArtifactDescriptorRepositories)
      Controls whether repositories declared in artifact descriptors should be ignored during transitive dependency collection. If enabled, only the repositories originally provided with the collect request will be considered.
      Parameters:
      ignoreArtifactDescriptorRepositories - true to ignore additional repositories from artifact descriptors, false to merge those with the originally specified repositories.
      Returns:
      This session for chaining, never null.
    • getResolutionErrorPolicy

      public org.eclipse.aether.resolution.ResolutionErrorPolicy getResolutionErrorPolicy()
      Specified by:
      getResolutionErrorPolicy in interface org.eclipse.aether.RepositorySystemSession
    • setResolutionErrorPolicy

      public TestRepositorySystemSession setResolutionErrorPolicy(org.eclipse.aether.resolution.ResolutionErrorPolicy resolutionErrorPolicy)
      Sets the policy which controls whether resolutions errors from remote repositories should be cached.
      Parameters:
      resolutionErrorPolicy - The resolution error policy for this session, may be null if resolution errors should generally not be cached.
      Returns:
      This session for chaining, never null.
    • getArtifactDescriptorPolicy

      public org.eclipse.aether.resolution.ArtifactDescriptorPolicy getArtifactDescriptorPolicy()
      Specified by:
      getArtifactDescriptorPolicy in interface org.eclipse.aether.RepositorySystemSession
    • setArtifactDescriptorPolicy

      public TestRepositorySystemSession setArtifactDescriptorPolicy(org.eclipse.aether.resolution.ArtifactDescriptorPolicy artifactDescriptorPolicy)
      Sets the policy which controls how errors related to reading artifact descriptors should be handled.
      Parameters:
      artifactDescriptorPolicy - The descriptor error policy for this session, may be null if descriptor errors should generally not be tolerated.
      Returns:
      This session for chaining, never null.
    • getChecksumPolicy

      Specified by:
      getChecksumPolicy in interface org.eclipse.aether.RepositorySystemSession
    • setChecksumPolicy

      Sets the global checksum policy. If set, the global checksum policy overrides the checksum policies of the remote repositories being used for resolution.
      Parameters:
      checksumPolicy - The global checksum policy, may be null/empty to apply the per-repository policies.
      Returns:
      This session for chaining, never null.
      See Also:
      • RepositoryPolicy.CHECKSUM_POLICY_FAIL
      • RepositoryPolicy.CHECKSUM_POLICY_IGNORE
      • RepositoryPolicy.CHECKSUM_POLICY_WARN
    • getUpdatePolicy

      Specified by:
      getUpdatePolicy in interface org.eclipse.aether.RepositorySystemSession
    • setUpdatePolicy

      Sets the global update policy. If set, the global update policy overrides the update policies of the remote repositories being used for resolution.

      This method is meant for code that does not want to distinguish between artifact and metadata policies. Note: applications should either use get/set updatePolicy (this method and RepositorySystemSession.getUpdatePolicy()) or also distinguish between artifact and metadata update policies (and use other methods), but should not mix the two!

      Parameters:
      updatePolicy - The global update policy, may be null/empty to apply the per-repository policies.
      Returns:
      This session for chaining, never null.
      See Also:
    • getArtifactUpdatePolicy

      Specified by:
      getArtifactUpdatePolicy in interface org.eclipse.aether.RepositorySystemSession
    • setArtifactUpdatePolicy

      Sets the global artifact update policy. If set, the global update policy overrides the artifact update policies of the remote repositories being used for resolution.
      Parameters:
      artifactUpdatePolicy - The global update policy, may be null/empty to apply the per-repository policies.
      Returns:
      This session for chaining, never null.
      Since:
      2.0.0
      See Also:
      • RepositoryPolicy.UPDATE_POLICY_ALWAYS
      • RepositoryPolicy.UPDATE_POLICY_DAILY
      • RepositoryPolicy.UPDATE_POLICY_NEVER
    • getMetadataUpdatePolicy

      Specified by:
      getMetadataUpdatePolicy in interface org.eclipse.aether.RepositorySystemSession
    • setMetadataUpdatePolicy

      Sets the global metadata update policy. If set, the global update policy overrides the metadata update policies of the remote repositories being used for resolution.
      Parameters:
      metadataUpdatePolicy - The global update policy, may be null/empty to apply the per-repository policies.
      Returns:
      This session for chaining, never null.
      Since:
      2.0.0
      See Also:
      • RepositoryPolicy.UPDATE_POLICY_ALWAYS
      • RepositoryPolicy.UPDATE_POLICY_DAILY
      • RepositoryPolicy.UPDATE_POLICY_NEVER
    • getLocalRepository

      public org.eclipse.aether.repository.LocalRepository getLocalRepository()
      Specified by:
      getLocalRepository in interface org.eclipse.aether.RepositorySystemSession
    • getLocalRepositoryManager

      public org.eclipse.aether.repository.LocalRepositoryManager getLocalRepositoryManager()
      Specified by:
      getLocalRepositoryManager in interface org.eclipse.aether.RepositorySystemSession
    • setLocalRepositoryManager

      public TestRepositorySystemSession setLocalRepositoryManager(org.eclipse.aether.repository.LocalRepositoryManager localRepositoryManager)
      Sets the local repository manager used during this session. Note: Eventually, a valid session must have a local repository manager set.
      Parameters:
      localRepositoryManager - The local repository manager used during this session, may be null.
      Returns:
      This session for chaining, never null.
    • getWorkspaceReader

      public org.eclipse.aether.repository.WorkspaceReader getWorkspaceReader()
      Specified by:
      getWorkspaceReader in interface org.eclipse.aether.RepositorySystemSession
    • setWorkspaceReader

      public TestRepositorySystemSession setWorkspaceReader(org.eclipse.aether.repository.WorkspaceReader workspaceReader)
      Sets the workspace reader used during this session. If set, the workspace reader will usually be consulted first to resolve artifacts.
      Parameters:
      workspaceReader - The workspace reader for this session, may be null if none.
      Returns:
      This session for chaining, never null.
    • getRepositoryListener

      public org.eclipse.aether.RepositoryListener getRepositoryListener()
      Specified by:
      getRepositoryListener in interface org.eclipse.aether.RepositorySystemSession
    • setRepositoryListener

      public TestRepositorySystemSession setRepositoryListener(org.eclipse.aether.RepositoryListener repositoryListener)
      Sets the listener being notified of actions in the repository system.
      Parameters:
      repositoryListener - The repository listener, may be null if none.
      Returns:
      This session for chaining, never null.
    • getTransferListener

      public org.eclipse.aether.transfer.TransferListener getTransferListener()
      Specified by:
      getTransferListener in interface org.eclipse.aether.RepositorySystemSession
    • setTransferListener

      public TestRepositorySystemSession setTransferListener(org.eclipse.aether.transfer.TransferListener transferListener)
      Sets the listener being notified of uploads/downloads by the repository system.
      Parameters:
      transferListener - The transfer listener, may be null if none.
      Returns:
      This session for chaining, never null.
    • getSystemProperties

      Specified by:
      getSystemProperties in interface org.eclipse.aether.RepositorySystemSession
    • setSystemProperties

      public TestRepositorySystemSession setSystemProperties(Map<?,?> systemProperties)
      Sets the system properties to use, e.g. for processing of artifact descriptors. System properties are usually collected from the runtime environment like System.getProperties() and environment variables.

      Note: System properties are of type Map<String, String> and any key-value pair in the input map that doesn't match this type will be silently ignored.

      Parameters:
      systemProperties - The system properties, may be null or empty if none.
      Returns:
      This session for chaining, never null.
    • setSystemProperty

      Sets the specified system property.
      Parameters:
      key - The property key, must not be null.
      value - The property value, may be null to remove/unset the property.
      Returns:
      This session for chaining, never null.
    • getUserProperties

      Specified by:
      getUserProperties in interface org.eclipse.aether.RepositorySystemSession
    • setUserProperties

      public TestRepositorySystemSession setUserProperties(Map<?,?> userProperties)
      Sets the user properties to use, e.g. for processing of artifact descriptors. User properties are similar to system properties but are set on the discretion of the user and hence are considered of higher priority than system properties in case of conflicts.

      Note: User properties are of type Map<String, String> and any key-value pair in the input map that doesn't match this type will be silently ignored.

      Parameters:
      userProperties - The user properties, may be null or empty if none.
      Returns:
      This session for chaining, never null.
    • setUserProperty

      Sets the specified user property.
      Parameters:
      key - The property key, must not be null.
      value - The property value, may be null to remove/unset the property.
      Returns:
      This session for chaining, never null.
    • getConfigProperties

      Specified by:
      getConfigProperties in interface org.eclipse.aether.RepositorySystemSession
    • setConfigProperties

      public TestRepositorySystemSession setConfigProperties(Map<?,?> configProperties)
      Sets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling, connector-specific behavior, etc.).

      Note: Configuration properties are of type Map<String, Object> and any key-value pair in the input map that doesn't match this type will be silently ignored.

      Parameters:
      configProperties - The configuration properties, may be null or empty if none.
      Returns:
      This session for chaining, never null.
    • setConfigProperty

      Sets the specified configuration property.
      Parameters:
      key - The property key, must not be null.
      value - The property value, may be null to remove/unset the property.
      Returns:
      This session for chaining, never null.
    • getMirrorSelector

      public org.eclipse.aether.repository.MirrorSelector getMirrorSelector()
      Specified by:
      getMirrorSelector in interface org.eclipse.aether.RepositorySystemSession
    • setMirrorSelector

      public TestRepositorySystemSession setMirrorSelector(org.eclipse.aether.repository.MirrorSelector mirrorSelector)
      Sets the mirror selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to denote the effective repositories.
      Parameters:
      mirrorSelector - The mirror selector to use, may be null.
      Returns:
      This session for chaining, never null.
    • getProxySelector

      public org.eclipse.aether.repository.ProxySelector getProxySelector()
      Specified by:
      getProxySelector in interface org.eclipse.aether.RepositorySystemSession
    • setProxySelector

      public TestRepositorySystemSession setProxySelector(org.eclipse.aether.repository.ProxySelector proxySelector)
      Sets the proxy selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to have their proxy (if any) already set.
      Parameters:
      proxySelector - The proxy selector to use, may be null.
      Returns:
      This session for chaining, never null.
      See Also:
      • RemoteRepository.getProxy()
    • getAuthenticationSelector

      public org.eclipse.aether.repository.AuthenticationSelector getAuthenticationSelector()
      Specified by:
      getAuthenticationSelector in interface org.eclipse.aether.RepositorySystemSession
    • setAuthenticationSelector

      public TestRepositorySystemSession setAuthenticationSelector(org.eclipse.aether.repository.AuthenticationSelector authenticationSelector)
      Sets the authentication selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to have their authentication (if any) already set.
      Parameters:
      authenticationSelector - The authentication selector to use, may be null.
      Returns:
      This session for chaining, never null.
      See Also:
      • RemoteRepository.getAuthentication()
    • getArtifactTypeRegistry

      public org.eclipse.aether.artifact.ArtifactTypeRegistry getArtifactTypeRegistry()
      Specified by:
      getArtifactTypeRegistry in interface org.eclipse.aether.RepositorySystemSession
    • setArtifactTypeRegistry

      public TestRepositorySystemSession setArtifactTypeRegistry(org.eclipse.aether.artifact.ArtifactTypeRegistry artifactTypeRegistry)
      Sets the registry of artifact types recognized by this session.
      Parameters:
      artifactTypeRegistry - The artifact type registry, may be null.
      Returns:
      This session for chaining, never null.
    • getDependencyTraverser

      public org.eclipse.aether.collection.DependencyTraverser getDependencyTraverser()
      Specified by:
      getDependencyTraverser in interface org.eclipse.aether.RepositorySystemSession
    • setDependencyTraverser

      public TestRepositorySystemSession setDependencyTraverser(org.eclipse.aether.collection.DependencyTraverser dependencyTraverser)
      Sets the dependency traverser to use for building dependency graphs.
      Parameters:
      dependencyTraverser - The dependency traverser to use for building dependency graphs, may be null.
      Returns:
      This session for chaining, never null.
    • getDependencyManager

      public org.eclipse.aether.collection.DependencyManager getDependencyManager()
      Specified by:
      getDependencyManager in interface org.eclipse.aether.RepositorySystemSession
    • setDependencyManager

      public TestRepositorySystemSession setDependencyManager(org.eclipse.aether.collection.DependencyManager dependencyManager)
      Sets the dependency manager to use for building dependency graphs.
      Parameters:
      dependencyManager - The dependency manager to use for building dependency graphs, may be null.
      Returns:
      This session for chaining, never null.
    • getDependencySelector

      public org.eclipse.aether.collection.DependencySelector getDependencySelector()
      Specified by:
      getDependencySelector in interface org.eclipse.aether.RepositorySystemSession
    • setDependencySelector

      public TestRepositorySystemSession setDependencySelector(org.eclipse.aether.collection.DependencySelector dependencySelector)
      Sets the dependency selector to use for building dependency graphs.
      Parameters:
      dependencySelector - The dependency selector to use for building dependency graphs, may be null.
      Returns:
      This session for chaining, never null.
    • getVersionFilter

      public org.eclipse.aether.collection.VersionFilter getVersionFilter()
      Specified by:
      getVersionFilter in interface org.eclipse.aether.RepositorySystemSession
    • setVersionFilter

      public TestRepositorySystemSession setVersionFilter(org.eclipse.aether.collection.VersionFilter versionFilter)
      Sets the version filter to use for building dependency graphs.
      Parameters:
      versionFilter - The version filter to use for building dependency graphs, may be null to not filter versions.
      Returns:
      This session for chaining, never null.
    • getDependencyGraphTransformer

      public org.eclipse.aether.collection.DependencyGraphTransformer getDependencyGraphTransformer()
      Specified by:
      getDependencyGraphTransformer in interface org.eclipse.aether.RepositorySystemSession
    • setDependencyGraphTransformer

      public TestRepositorySystemSession setDependencyGraphTransformer(org.eclipse.aether.collection.DependencyGraphTransformer dependencyGraphTransformer)
      Sets the dependency graph transformer to use for building dependency graphs.
      Parameters:
      dependencyGraphTransformer - The dependency graph transformer to use for building dependency graphs, may be null.
      Returns:
      This session for chaining, never null.
    • getData

      public org.eclipse.aether.SessionData getData()
      Specified by:
      getData in interface org.eclipse.aether.RepositorySystemSession
    • setData

      public TestRepositorySystemSession setData(org.eclipse.aether.SessionData data)
      Sets the custom data associated with this session.
      Parameters:
      data - The session data, may be null.
      Returns:
      This session for chaining, never null.
    • getCache

      public org.eclipse.aether.RepositoryCache getCache()
      Specified by:
      getCache in interface org.eclipse.aether.RepositorySystemSession
    • setCache

      public TestRepositorySystemSession setCache(org.eclipse.aether.RepositoryCache cache)
      Sets the cache the repository system may use to save data for future reuse during the session.
      Parameters:
      cache - The repository cache, may be null if none.
      Returns:
      This session for chaining, never null.
    • addOnSessionEndedHandler

      public boolean addOnSessionEndedHandler(Runnable handler)
      Registers onSessionEnded handler, if able to.
      Specified by:
      addOnSessionEndedHandler in interface org.eclipse.aether.RepositorySystemSession
      Parameters:
      handler - The handler to register
      Returns:
      Return true if registration was possible, otherwise false.
    • setReadOnly

      public void setReadOnly()
      Marks this session as read-only such that any future attempts to call its mutators will fail with an exception. Marking an already read-only session as read-only has no effect. The session's data and cache remain writable though.