use of org.alfresco.repo.content.AbstractContentReader in project alfresco-repository by Alfresco.
the class AbstractContentTransformerLimits method setReaderLimits.
/**
* Pass on any limits to the reader. Will only do so if the reader is an
* {@link AbstractContentReader}.
* @param reader passed to {@link #transform(ContentReader, ContentWriter, TransformationOptions)}.
* @param writer passed to {@link #transform(ContentReader, ContentWriter, TransformationOptions)}.
* @param options passed to {@link #transform(ContentReader, ContentWriter, TransformationOptions)}.
*/
protected void setReaderLimits(ContentReader reader, ContentWriter writer, TransformationOptions options) {
if (reader instanceof AbstractContentReader) {
AbstractContentReader abstractContentReader = (AbstractContentReader) reader;
TransformationOptionLimits limits = getLimits(reader, writer, options);
abstractContentReader.setLimits(limits);
abstractContentReader.setTransformerDebug(transformerDebug);
}
}
use of org.alfresco.repo.content.AbstractContentReader in project alfresco-repository by Alfresco.
the class AbstractContentTransformerLimitsTest method testSetReaderLimits.
@Test
public void testSetReaderLimits() throws Exception {
AbstractContentReader reader = new DummyAbstractContentReader(0, 0);
long value = 1234;
transformer.setTimeoutMs(value);
transformer.register();
assertEquals("Limit should not have been set in the reader", null, reader.getLimits());
transformer.setReaderLimits(reader, null, options);
assertEquals("Limit should have been set in the reader", value, reader.getLimits().getTimeoutMs());
options.setTimeoutMs(--value);
transformer.setReaderLimits(reader, null, options);
assertEquals("Limit should have been set in the reader", value, reader.getLimits().getTimeoutMs());
}
Aggregations