use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method systemWideDefaultsUsedInTransformersTest.
@Test
public // transformer specific values.
void systemWideDefaultsUsedInTransformersTest() {
mockProperties(transformerProperties, "content.transformer.transformer1.extensions.pdf.png.maxSourceSizeKBytes", "10", "content.transformer.transformer1.maxSourceSizeKBytes", "15", "content.transformer.default.timeoutMs", "120000", "content.transformer.default.extensions.txt.png.pageLimit", "1");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits pdfToPngLimits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
assertEquals(10, pdfToPngLimits.getMaxSourceSizeKBytes());
assertEquals(120000L, pdfToPngLimits.getTimeoutMs());
assertEquals(-1, pdfToPngLimits.getPageLimit());
TransformationOptionLimits txtToPngLimits = extractor.getLimits(transformer1, "text/plain", "image/png", null);
assertEquals(15, txtToPngLimits.getMaxSourceSizeKBytes());
assertEquals(120000L, txtToPngLimits.getTimeoutMs());
assertEquals(1, txtToPngLimits.getPageLimit());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method dontCombineTest.
@Test
public // always specify them in the spring configuration, which was removed in 4.2.
void dontCombineTest() {
mockProperties(transformerProperties, "content.transformer.transformer1.extensions.pdf.png.maxSourceSizeKBytes", "-1", "content.transformer.transformer1.maxSourceSizeKBytes", "20");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
assertEquals(-1, limits.getMaxSourceSizeKBytes());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method bothMaxAndLimitSetIgnoreMaxTest.
@Test
public void bothMaxAndLimitSetIgnoreMaxTest() {
mockProperties(transformerProperties, "content.transformer.default.readLimitTimeMs", "120000", "content.transformer.default.timeoutMs", "990000");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "text/plain", "image/png", null);
assertEquals(-1L, limits.getTimeoutMs());
assertEquals(120000L, limits.getReadLimitTimeMs());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method systemWideWildcardTest.
@Test
public // Checks wildcard usage at the system wide level
void systemWideWildcardTest() {
mockProperties(transformerProperties, "content.transformer.transformer1.maxSourceSizeKBytes", "15", "content.transformer.default.timeoutMs", "120000", "content.transformer.default.extensions.txt.*.pageLimit", "1");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits txtToPngLimits = extractor.getLimits(transformer1, "text/plain", "image/png", null);
assertEquals(15, txtToPngLimits.getMaxSourceSizeKBytes());
assertEquals(120000L, txtToPngLimits.getTimeoutMs());
assertEquals(1, txtToPngLimits.getPageLimit());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method transformerTest.
@Test
public // A value is specified for a transformer
void transformerTest() {
mockProperties(transformerProperties, "content.transformer.transformer1.maxSourceSizeKBytes", "10");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
assertEquals(10, limits.getMaxSourceSizeKBytes());
}
Aggregations