use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method propertyOrderJava7Test.
// MNT-14295 With Java 7 the order in which properties were supplied changed from
// what happen with Java 6 and happens with 8. When combined with a bug to do with
// always clearing the max value when setting a limit or the limit when setting
// the max value, the initial map of TransformerConfigLimits would be different.
// Java 7 was used as the runtime for 4.2 and the 5.0 but Java 8 became the default
// from 5.0.1.
// None of the other unit tests in this class failed as a none of them provided
// both max and limit values.
@Test
public void propertyOrderJava7Test() {
mockProperties(transformerProperties, "content.transformer.default.timeoutMs", "120000", "content.transformer.default.readLimitTimeMs", "-1");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "text/plain", "image/png", null);
assertEquals(120000L, limits.getTimeoutMs());
assertEquals(-1L, limits.getReadLimitTimeMs());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method defaultTest.
@Test
public // A value is specified as a transformer default without mimetypes
void defaultTest() {
mockProperties(transformerProperties, "content.transformer.default.maxSourceSizeKBytes", "10");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
assertEquals(10, limits.getMaxSourceSizeKBytes());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method transformerWildcardTest.
@Test
public // Checks wildcard usage at the transformer level
void transformerWildcardTest() {
mockProperties(transformerProperties, "content.transformer.transformer1.extensions.*.png.maxSourceSizeKBytes", "10");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
assertEquals(10, limits.getMaxSourceSizeKBytes());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method bothMaxAndLimitSetIgnoreLimitTest.
@Test
public void bothMaxAndLimitSetIgnoreLimitTest() {
mockProperties(transformerProperties, "content.transformer.default.readLimitTimeMs", "990000", "content.transformer.default.timeoutMs", "120000");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "text/plain", "image/png", null);
assertEquals(120000L, limits.getTimeoutMs());
assertEquals(-1L, limits.getReadLimitTimeMs());
}
use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.
the class TransformerConfigLimitsTest method transformerMimetypesUseTest.
// ---------------------------------------
@Test
public // A value is specified for a transformer, mimetypes and use
void transformerMimetypesUseTest() {
mockProperties(transformerProperties, "content.transformer.transformer1.extensions.pdf.png.maxSourceSizeKBytes", "10", "content.transformer.transformer1.extensions.pdf.png.maxSourceSizeKBytes.use.index", "20");
extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
assertEquals(10, limits.getMaxSourceSizeKBytes());
limits = extractor.getLimits(transformer1, "application/pdf", "image/png", "index");
assertEquals(20, limits.getMaxSourceSizeKBytes());
}
Aggregations