com.android.repository.testframework
Class FakePackage

java.lang.Object
  extended by com.android.repository.testframework.FakePackage
All Implemented Interfaces:
LocalPackage, RemotePackage, RepoPackage, java.lang.Comparable<RepoPackage>

public class FakePackage
extends java.lang.Object
implements LocalPackage, RemotePackage

A fake RepoPackage (implementing both LocalPackage and RemotePackage, for use in unit tests. Currently not especially fully-featured.


Field Summary
 
Fields inherited from interface com.android.repository.api.RepoPackage
PATH_SEPARATOR
 
Constructor Summary
FakePackage(java.lang.String path, Revision version, java.util.Collection<Dependency> dependencies)
           
 
Method Summary
 int compareTo(RepoPackage o)
           
 CommonFactory createFactory()
          Creates a CommonFactory corresponding to the SchemaModule.SchemaModuleVersion of this instance.
 boolean equals(java.lang.Object obj)
           
 java.util.Collection<Dependency> getAllDependencies()
          Gets information on what versions of what packages this package depends on.
 Archive getArchive()
           
 Channel getChannel()
          Gets the update channel (e.g.
 java.lang.String getDisplayName()
          Gets the user-friendly name of this package.
 License getLicense()
          Gets the License, if any, associated with this package.
 java.io.File getLocation()
          Gets the installed location of this package.
 java.lang.String getPath()
          The install path (which also serves as unique id) for this package.
 RepositorySource getSource()
           
 TypeDetails getTypeDetails()
          Gets the TypeDetails for this package.
 Revision getVersion()
          Gets the Revision of this package.
 int hashCode()
           
 boolean obsolete()
          Whether this package is obsolete.
 void setChannel(Channel channel)
           
 void setCompleteUrl(java.lang.String url)
           
 void setInstalledPath(java.io.File root)
          Specifies the path at which this package is installed.
 void setSource(RepositorySource source)
           
 void setTypeDetails(TypeDetails details)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FakePackage

public FakePackage(java.lang.String path,
                   Revision version,
                   java.util.Collection<Dependency> dependencies)
Method Detail

getSource

@NonNull
public RepositorySource getSource()
Specified by:
getSource in interface RemotePackage
Returns:
The RepositorySource from which we got this package.

setSource

public void setSource(@NonNull
                      RepositorySource source)
Specified by:
setSource in interface RemotePackage
Parameters:
source - The RepositorySource from which we got this package.

getArchive

@Nullable
public Archive getArchive()
Specified by:
getArchive in interface RemotePackage
Returns:
The archive in this package compatible with the current hardware, OS, and JDK, or null if there is none.

setCompleteUrl

public void setCompleteUrl(java.lang.String url)

setChannel

public void setChannel(Channel channel)

getChannel

@NonNull
public Channel getChannel()
Description copied from interface: RemotePackage
Gets the update channel (e.g. beta, stable) for this package. Channels are sorted in lexicographic order, with the first (and default) being the most stable.

Specified by:
getChannel in interface RemotePackage

setTypeDetails

public void setTypeDetails(TypeDetails details)

getTypeDetails

@NonNull
public TypeDetails getTypeDetails()
Description copied from interface: RepoPackage
Gets the TypeDetails for this package.

Specified by:
getTypeDetails in interface RepoPackage

getVersion

@NonNull
public Revision getVersion()
Description copied from interface: RepoPackage
Gets the Revision of this package.

Specified by:
getVersion in interface RepoPackage

getDisplayName

@NonNull
public java.lang.String getDisplayName()
Description copied from interface: RepoPackage
Gets the user-friendly name of this package.

Specified by:
getDisplayName in interface RepoPackage

getLicense

@Nullable
public License getLicense()
Description copied from interface: RepoPackage
Gets the License, if any, associated with this package.

Specified by:
getLicense in interface RepoPackage

getAllDependencies

@NonNull
public java.util.Collection<Dependency> getAllDependencies()
Description copied from interface: RepoPackage
Gets information on what versions of what packages this package depends on.

Specified by:
getAllDependencies in interface RepoPackage

getPath

@NonNull
public java.lang.String getPath()
Description copied from interface: RepoPackage
The install path (which also serves as unique id) for this package.

Specified by:
getPath in interface RepoPackage

obsolete

public boolean obsolete()
Description copied from interface: RepoPackage
Whether this package is obsolete.

Specified by:
obsolete in interface RepoPackage

createFactory

@NonNull
public CommonFactory createFactory()
Description copied from interface: RepoPackage
Creates a CommonFactory corresponding to the SchemaModule.SchemaModuleVersion of this instance.

Specified by:
createFactory in interface RepoPackage

compareTo

public int compareTo(@NonNull
                     RepoPackage o)
Specified by:
compareTo in interface java.lang.Comparable<RepoPackage>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getLocation

@NonNull
public java.io.File getLocation()
Description copied from interface: LocalPackage
Gets the installed location of this package.

Specified by:
getLocation in interface LocalPackage

setInstalledPath

public void setInstalledPath(@NonNull
                             java.io.File root)
Description copied from interface: LocalPackage
Specifies the path at which this package is installed. This should be called directly after the package is created.

Specified by:
setInstalledPath in interface LocalPackage

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object