public class MockFlowFile extends Object implements FlowFileRecord
FlowFile.KeyValidator
Modifier and Type | Field and Description |
---|---|
private Map<String,String> |
attributes |
private long |
creationTime |
private byte[] |
data |
private long |
enqueuedIndex |
private long |
entryDate |
private long |
id |
private long |
lastEnqueuedDate |
private boolean |
penalized |
Constructor and Description |
---|
MockFlowFile(long id) |
MockFlowFile(long id,
FlowFile toCopy) |
Modifier and Type | Method and Description |
---|---|
void |
assertAttributeEquals(String attributeName,
String expectedValue) |
void |
assertAttributeExists(String attributeName) |
void |
assertAttributeNotEquals(String attributeName,
String expectedValue) |
void |
assertAttributeNotExists(String attributeName) |
void |
assertContentEquals(byte[] data)
Asserts that the content of this FlowFile is the same as the content of
the given byte array
|
void |
assertContentEquals(File file)
Asserts that the content of this FlowFile is the same as the content of
the given file
|
void |
assertContentEquals(InputStream in)
Asserts that the content of this FlowFile is the same as the content of
the given InputStream.
|
void |
assertContentEquals(Path path)
Asserts that the content of this FlowFile is the same as the content of
the given path
|
void |
assertContentEquals(String data) |
void |
assertContentEquals(String data,
Charset charset) |
void |
assertContentEquals(String data,
String charset) |
int |
compareTo(FlowFile o) |
boolean |
equals(Object obj) |
String |
getAttribute(String attrName) |
Map<String,String> |
getAttributes() |
String |
getContent()
Returns the value of the internal content for this mock flowfile as a UTF-8 encoded String.
|
ContentClaim |
getContentClaim() |
long |
getContentClaimOffset() |
InputStream |
getContentStream()
Returns the value of the internal content for this mock flowfile as an
InputStream . |
long |
getCreationTime() |
byte[] |
getData()
Returns the value of the internal content for this mock flowfile.
|
long |
getEntryDate() |
long |
getId() |
Long |
getLastQueueDate() |
long |
getLineageStartDate() |
long |
getLineageStartIndex() |
long |
getPenaltyExpirationMillis() |
long |
getQueueDateIndex() |
long |
getSize() |
int |
hashCode() |
boolean |
isAttributeEqual(String attributeName,
String expectedValue) |
boolean |
isContentEqual(byte[] expected) |
boolean |
isContentEqual(String expected) |
boolean |
isContentEqual(String expected,
Charset charset) |
boolean |
isPenalized() |
void |
putAttributes(Map<String,String> attrs) |
void |
removeAttributes(Set<String> attrNames) |
void |
setData(byte[] data)
Sets the value of the internal content for this mock flowfile.
|
void |
setEnqueuedIndex(long enqueuedIndex) |
void |
setLastEnqueuedDate(long lastEnqueuedDate) |
(package private) void |
setPenalized(boolean penalized) |
byte[] |
toByteArray() |
String |
toString() |
private final long id
private final long entryDate
private final long creationTime
private boolean penalized
private byte[] data
private long lastEnqueuedDate
private long enqueuedIndex
public MockFlowFile(long id)
public MockFlowFile(long id, FlowFile toCopy)
void setPenalized(boolean penalized)
public long getCreationTime()
public long getLineageStartDate()
getLineageStartDate
in interface FlowFile
public int compareTo(FlowFile o)
compareTo
in interface Comparable<FlowFile>
public String getAttribute(String attrName)
getAttribute
in interface FlowFile
public Map<String,String> getAttributes()
getAttributes
in interface FlowFile
public long getEntryDate()
getEntryDate
in interface FlowFile
public void setData(byte[] data)
FlowFile
implementations, but useful for complex test assertions.data
- the flowfile content as a byte[]public byte[] getData()
FlowFile
implementations, but useful for complex test assertions.public String getContent()
FlowFile
implementations, but useful for complex test assertions.public InputStream getContentStream()
InputStream
. Would not exist in standard FlowFile
implementations, but useful for complex test assertions.public boolean isPenalized()
isPenalized
in interface FlowFile
public void assertAttributeExists(String attributeName)
public void assertAttributeNotExists(String attributeName)
public void assertAttributeNotEquals(String attributeName, String expectedValue)
public void assertContentEquals(File file) throws IOException
file
- to compare content againstIOException
- if fails doing IO during comparisonpublic void assertContentEquals(Path path) throws IOException
path
- where to find content to compare toIOException
- if io error occurs while comparing contentpublic void assertContentEquals(byte[] data) throws IOException
data
- the data to compareIOException
- if any ioe occurs while reading flowfilepublic void assertContentEquals(String data)
public void assertContentEquals(InputStream in) throws IOException
in
- the stream to source comparison data fromIOException
- if any issues reading from given sourcepublic byte[] toByteArray()
public Long getLastQueueDate()
getLastQueueDate
in interface FlowFile
public void setLastEnqueuedDate(long lastEnqueuedDate)
public long getPenaltyExpirationMillis()
getPenaltyExpirationMillis
in interface FlowFileRecord
public ContentClaim getContentClaim()
getContentClaim
in interface FlowFileRecord
public long getContentClaimOffset()
getContentClaimOffset
in interface FlowFileRecord
public long getLineageStartIndex()
getLineageStartIndex
in interface FlowFile
public long getQueueDateIndex()
getQueueDateIndex
in interface FlowFile
public void setEnqueuedIndex(long enqueuedIndex)
public boolean isContentEqual(String expected)
public boolean isContentEqual(byte[] expected)
Copyright © 2020 Apache NiFi Project. All rights reserved.