Package software.amazon.smithy.build
Class MockManifest
java.lang.Object
software.amazon.smithy.build.MockManifest
- All Implemented Interfaces:
- FileManifest
A 
FileManifest that doesn't actually store files on disk.
 This manifest is useful for testing SmithyBuildPlugin implementations.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumThe way in which files are stored.
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a mock manifest that stores files in memory and uses a base directory of "/".MockManifest(Path baseDir) Creates a mock manifest that stores files in memory.MockManifest(Path baseDir, MockManifest.StoreMode storeMode) 
- 
Method SummaryModifier and TypeMethodDescriptionAdds a path to the manifest.byte[]expectFileBytes(String file) Expects that the given file was stored and returns the bytes.byte[]expectFileBytes(Path file) Expects that the given file was stored and returns the bytes.expectFileString(String file) Expects that the given file was stored and returns a UTF-8 string.expectFileString(Path file) Expects that the given file was stored and returns a UTF-8 string.Gets the base directory of the manifest.Optional<byte[]>getFileBytes(String file) Gets the bytes of a stored file.Optional<byte[]>getFileBytes(Path file) Gets the bytes of a stored file.getFiles()Gets all of the files in the result.getFileString(String file) Gets the contents of a stored file as a String.getFileString(Path file) Gets the contents of a stored file as a String.writeFile(Path path, InputStream fileContentsInputStream) Adds a file to the result using the contents of anInputStream.Adds a file to the result using the contents of aReader.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.smithy.build.FileManifestaddAllFiles, getFilesIn, getFilesIn, hasFile, hasFile, resolvePath, writeFile, writeFile, writeFile, writeFile, writeFile, writeFile, writeJson, writeJson
- 
Constructor Details- 
MockManifest- Parameters:
- baseDir- Base directory of the manifest.
- storeMode- How files are stored in the mock.
 
- 
MockManifestCreates a mock manifest that stores files in memory.- Parameters:
- baseDir- Base directory of the manifest.
 
- 
MockManifestpublic MockManifest()Creates a mock manifest that stores files in memory and uses a base directory of "/".
 
- 
- 
Method Details- 
getBaseDirDescription copied from interface:FileManifestGets the base directory of the manifest.- Specified by:
- getBaseDirin interface- FileManifest
- Returns:
- Returns the base directory.
 
- 
getFilesDescription copied from interface:FileManifestGets all of the files in the result.The order of files returned should be stable across calls. - Specified by:
- getFilesin interface- FileManifest
- Returns:
- Returns the files in the manifest.
 
- 
addFileDescription copied from interface:FileManifestAdds a path to the manifest.The given path must be relative or within the base directory. - Specified by:
- addFilein interface- FileManifest
- Parameters:
- path- Path to add.
- Returns:
- Returns the path resolved against any base URL.
 
- 
writeFileDescription copied from interface:FileManifestAdds a file to the result using the contents of aReader.This method will write the contents of a Reader to a file. - Specified by:
- writeFilein interface- FileManifest
- Parameters:
- path- Relative path to the file to create.
- fileContentsReader- Reader to consume and write to the file.
- Returns:
- Returns the resolved path.
 
- 
writeFileDescription copied from interface:FileManifestAdds a file to the result using the contents of anInputStream.This method will write the contents of an input stream to a file. - Specified by:
- writeFilein interface- FileManifest
- Parameters:
- path- Relative path to the file to create.
- fileContentsInputStream- InputStream to consume and write to the file.
- Returns:
- Returns the resolved path.
 
- 
getFileStringGets the contents of a stored file as a String.- Parameters:
- file- Relative or absolute path to the file to retrieve.
- Returns:
- Returns the optionally found file string.
- Throws:
- SmithyBuildException- if the file cannot be read as UTF-8.
 
- 
getFileStringGets the contents of a stored file as a String.- Parameters:
- file- Relative or absolute path to the file to retrieve.
- Returns:
- Returns the optionally found file string.
- Throws:
- SmithyBuildException- if the file cannot be read as UTF-8.
 
- 
expectFileStringExpects that the given file was stored and returns a UTF-8 string.- Parameters:
- file- File to retrieve.
- Returns:
- Returns the bytes of the file if found.
- Throws:
- InvalidPathException- if the file cannot be found.
 
- 
expectFileStringExpects that the given file was stored and returns a UTF-8 string.- Parameters:
- file- File to retrieve.
- Returns:
- Returns the bytes of the file if found.
- Throws:
- InvalidPathException- if the file cannot be found.
 
- 
getFileBytesGets the bytes of a stored file.- Parameters:
- file- Relative or absolute path to the file to retrieve.
- Returns:
- Returns the optionally found file by.es,
 
- 
getFileBytesGets the bytes of a stored file.- Parameters:
- file- Relative or absolute path to the file to retrieve.
- Returns:
- Returns the optionally found file by.es,
 
- 
expectFileBytesExpects that the given file was stored and returns the bytes.- Parameters:
- file- File to retrieve.
- Returns:
- Returns the bytes of the file if found.
- Throws:
- InvalidPathException- if the file cannot be found.
 
- 
expectFileBytesExpects that the given file was stored and returns the bytes.- Parameters:
- file- File to retrieve.
- Returns:
- Returns the bytes of the file if found.
- Throws:
- InvalidPathException- if the file cannot be found.
 
 
-