Search in sources :

Example 6 with TransformationOptionLimits

use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.

the class TransformerConfigLimitsTest method transformerDefaultsUsedInMimetypesTest.

// ---------------------------------------
@Test
public // Checks that transformer defaults are combined to construct mimetype specific values
void transformerDefaultsUsedInMimetypesTest() {
    mockProperties(transformerProperties, "content.transformer.transformer1.extensions.pdf.png.maxSourceSizeKBytes", "10", "content.transformer.transformer1.timeoutMs", "10000");
    extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
    TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
    assertEquals(10, limits.getMaxSourceSizeKBytes());
    assertEquals(10000L, limits.getTimeoutMs());
}
Also used : TransformationOptionLimits(org.alfresco.service.cmr.repository.TransformationOptionLimits) Test(org.junit.Test)

Example 7 with TransformationOptionLimits

use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.

the class TransformerConfigLimitsTest method useSetTest.

@Test
public // Checks limit does not change if use param is specified but not specifically set
void useSetTest() {
    mockProperties(transformerProperties, "content.transformer.transformer1.pageLimit.use.doclib", "22", "content.transformer.transformer1.pageLimit", "76");
    extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
    TransformationOptionLimits transformerDefaultLimits = extractor.getLimits(transformer1, null, null, null);
    TransformationOptionLimits transformerDoclibLimits = extractor.getLimits(transformer1, null, null, "doclib");
    assertEquals(76, transformerDefaultLimits.getPageLimit());
    assertEquals(22, transformerDoclibLimits.getPageLimit());
}
Also used : TransformationOptionLimits(org.alfresco.service.cmr.repository.TransformationOptionLimits) Test(org.junit.Test)

Example 8 with TransformationOptionLimits

use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.

the class TransformerConfigLimitsTest method defaultUseTest2.

@Test
public // A value is specified as a transformer default without mimetypes but with a use
void defaultUseTest2() {
    mockProperties(transformerProperties, "content.transformer.default.maxSourceSizeKBytes", "10", "content.transformer.default.maxSourceSizeKBytes.use.index", "20", // The following is ignored when "index" is specified, as the 'use' property is system wide.
    "content.transformer.transformer2.maxSourceSizeKBytes", "30");
    extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
    TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
    assertEquals(10, limits.getMaxSourceSizeKBytes());
    limits = extractor.getLimits(transformer2, "application/pdf", "image/png", null);
    assertEquals(30, limits.getMaxSourceSizeKBytes());
    limits = extractor.getLimits(transformer1, "application/pdf", "image/png", "index");
    assertEquals(20, limits.getMaxSourceSizeKBytes());
    limits = extractor.getLimits(transformer2, "application/pdf", "image/png", "index");
    assertEquals(20, limits.getMaxSourceSizeKBytes());
}
Also used : TransformationOptionLimits(org.alfresco.service.cmr.repository.TransformationOptionLimits) Test(org.junit.Test)

Example 9 with TransformationOptionLimits

use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.

the class TransformerConfigLimitsTest method transformerMimetypesTest.

@Test
public // A value is specified for a transformer and mimetypes
void transformerMimetypesTest() {
    mockProperties(transformerProperties, "content.transformer.transformer1.extensions.pdf.png.maxSourceSizeKBytes", "10");
    extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
    TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
    assertEquals(10, limits.getMaxSourceSizeKBytes());
}
Also used : TransformationOptionLimits(org.alfresco.service.cmr.repository.TransformationOptionLimits) Test(org.junit.Test)

Example 10 with TransformationOptionLimits

use of org.alfresco.service.cmr.repository.TransformationOptionLimits in project alfresco-repository by Alfresco.

the class TransformerConfigLimitsTest method defaultMimetypesTest.

@Test
public // A value is specified as a transformer default with mimetypes
void defaultMimetypesTest() {
    mockProperties(transformerProperties, "content.transformer.default.extensions.pdf.png.maxSourceSizeKBytes", "10");
    extractor = new TransformerConfigLimits(transformerProperties, mimetypeService);
    TransformationOptionLimits limits = extractor.getLimits(transformer1, "application/pdf", "image/png", null);
    assertEquals(10, limits.getMaxSourceSizeKBytes());
}
Also used : TransformationOptionLimits(org.alfresco.service.cmr.repository.TransformationOptionLimits) Test(org.junit.Test)

Aggregations

TransformationOptionLimits (org.alfresco.service.cmr.repository.TransformationOptionLimits)39 Test (org.junit.Test)22 Map (java.util.Map)3 TransformationOptions (org.alfresco.service.cmr.repository.TransformationOptions)3 TimeoutException (java.util.concurrent.TimeoutException)2 AbstractContentReader (org.alfresco.repo.content.AbstractContentReader)2 ImageResizeOptions (org.alfresco.repo.content.transform.magick.ImageResizeOptions)2 ImageTransformationOptions (org.alfresco.repo.content.transform.magick.ImageTransformationOptions)2 SWFTransformationOptions (org.alfresco.repo.content.transform.swf.SWFTransformationOptions)2 ContentIOException (org.alfresco.service.cmr.repository.ContentIOException)2 TransformationOptionPair (org.alfresco.service.cmr.repository.TransformationOptionPair)2 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 OutputStream (java.io.OutputStream)1 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1