diff --git a/pom.xml b/pom.xml
index 48da617a9e..ef542c0ec4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,7 @@
2.0.16
3.3.2
2.9.9
+ 1.0.2.5
@@ -987,6 +988,13 @@
+
+
+ org.alfresco
+ alfresco-transform-model
+ ${dependency.transform.model.version}
+
+
org.mockito
diff --git a/src/main/java/org/alfresco/repo/content/transform/LocalTransformServiceRegistry.java b/src/main/java/org/alfresco/repo/content/transform/LocalTransformServiceRegistry.java
index 95b2dd7aff..bb83774095 100644
--- a/src/main/java/org/alfresco/repo/content/transform/LocalTransformServiceRegistry.java
+++ b/src/main/java/org/alfresco/repo/content/transform/LocalTransformServiceRegistry.java
@@ -30,10 +30,10 @@ import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.transform.client.model.config.CombinedConfig;
+import org.alfresco.transform.client.model.config.InlineTransformer;
import org.alfresco.transform.client.model.config.TransformServiceRegistry;
import org.alfresco.transform.client.model.config.TransformServiceRegistryImpl;
import org.alfresco.transform.client.model.config.TransformStep;
-import org.alfresco.transform.client.model.config.Transformer;
import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -157,7 +157,7 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
}
@Override
- protected void register(Transformer transformer, String baseUrl, String readFrom)
+ protected void register(InlineTransformer transformer, String baseUrl, String readFrom)
{
try
{
diff --git a/src/main/java/org/alfresco/transform/client/model/config/AbstractTransformOption.java b/src/main/java/org/alfresco/transform/client/model/config/AbstractTransformOption.java
deleted file mode 100644
index 5566128979..0000000000
--- a/src/main/java/org/alfresco/transform/client/model/config/AbstractTransformOption.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2019 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.transform.client.model.config;
-
-/**
- * Abstract implementation of TransformOption.
- */
-public abstract class AbstractTransformOption implements TransformOption
-{
- private boolean required;
-
- @Override
- public boolean isRequired()
- {
- return required;
- }
-
- @Override
- public void setRequired(boolean required)
- {
- this.required = required;
- }
-}
diff --git a/src/main/java/org/alfresco/transform/client/model/config/ChildTransformer.java b/src/main/java/org/alfresco/transform/client/model/config/ChildTransformer.java
index 3fe84f2268..382f7b3ddd 100644
--- a/src/main/java/org/alfresco/transform/client/model/config/ChildTransformer.java
+++ b/src/main/java/org/alfresco/transform/client/model/config/ChildTransformer.java
@@ -32,13 +32,13 @@ package org.alfresco.transform.client.model.config;
public class ChildTransformer
{
private boolean required;
- private Transformer transformer;
+ private InlineTransformer transformer;
public ChildTransformer()
{
}
- public ChildTransformer(boolean required, Transformer transformer)
+ public ChildTransformer(boolean required, InlineTransformer transformer)
{
this.required = required;
this.transformer = transformer;
@@ -54,12 +54,12 @@ public class ChildTransformer
this.required = required;
}
- public Transformer getTransformer()
+ public InlineTransformer getTransformer()
{
return transformer;
}
- public void setTransformer(Transformer transformer)
+ public void setTransformer(InlineTransformer transformer)
{
this.transformer = transformer;
}
diff --git a/src/main/java/org/alfresco/transform/client/model/config/CombinedConfig.java b/src/main/java/org/alfresco/transform/client/model/config/CombinedConfig.java
index ea80070b63..7c9363b503 100644
--- a/src/main/java/org/alfresco/transform/client/model/config/CombinedConfig.java
+++ b/src/main/java/org/alfresco/transform/client/model/config/CombinedConfig.java
@@ -91,11 +91,11 @@ public class CombinedConfig
static class TransformAndItsOrigin
{
- final Transformer transform;
+ final InlineTransformer transform;
final String baseUrl;
final String readFrom;
- TransformAndItsOrigin(Transformer transform, String baseUrl, String readFrom)
+ TransformAndItsOrigin(InlineTransformer transform, String baseUrl, String readFrom)
{
this.transform = transform;
this.baseUrl = baseUrl;
@@ -327,7 +327,7 @@ public class CombinedConfig
try
{
- Transformer transform = jsonObjectMapper.convertValue(entity.node, Transformer.class);
+ InlineTransformer transform = jsonObjectMapper.convertValue(entity.node, InlineTransformer.class);
transforms.add(new TransformAndItsOrigin(transform, entity.baseUrl, entity.readFrom));
}
catch (IllegalArgumentException e)
diff --git a/src/main/java/org/alfresco/transform/client/model/config/SupportedSourceAndTarget.java b/src/main/java/org/alfresco/transform/client/model/config/SupportedSourceAndTarget.java
deleted file mode 100644
index 2f9860bea9..0000000000
--- a/src/main/java/org/alfresco/transform/client/model/config/SupportedSourceAndTarget.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2019 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.transform.client.model.config;
-
-/**
- * Represents a single source and target combination supported by a transformer. File extensions are used to keep the
- * json human readable. Each par also has an optional maximum size for the source content.
- */
-public class SupportedSourceAndTarget
-{
- private String sourceMediaType;
- private long maxSourceSizeBytes = -1;
- private String targetMediaType;
- private int priority = 50;
-
- public SupportedSourceAndTarget()
- {
- }
-
- public SupportedSourceAndTarget(String sourceMediaType, String targetMediaType, long maxSourceSizeBytes)
- {
- this(sourceMediaType, targetMediaType, maxSourceSizeBytes, 50);
- }
-
- public SupportedSourceAndTarget(String sourceMediaType, String targetMediaType, long maxSourceSizeBytes, int priority)
- {
- setSourceMediaType(sourceMediaType);
- setMaxSourceSizeBytes(maxSourceSizeBytes);
- setTargetMediaType(targetMediaType);
- setPriority(priority);
- }
-
- public String getSourceMediaType()
- {
- return sourceMediaType;
- }
-
- public void setSourceMediaType(String sourceMediaType)
- {
- this.sourceMediaType = sourceMediaType;
- }
-
- public long getMaxSourceSizeBytes()
- {
- return maxSourceSizeBytes;
- }
-
- public void setMaxSourceSizeBytes(long maxSourceSizeBytes)
- {
- this.maxSourceSizeBytes = maxSourceSizeBytes;
- }
-
- public String getTargetMediaType()
- {
- return targetMediaType;
- }
-
- public void setTargetMediaType(String targetMediaType)
- {
- this.targetMediaType = targetMediaType;
- }
-
- public int getPriority()
- {
- return priority;
- }
-
- public void setPriority(int priority)
- {
- this.priority = priority;
- }
-}
diff --git a/src/main/java/org/alfresco/transform/client/model/config/TransformOption.java b/src/main/java/org/alfresco/transform/client/model/config/TransformOption.java
deleted file mode 100644
index dc73be1551..0000000000
--- a/src/main/java/org/alfresco/transform/client/model/config/TransformOption.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2019 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.transform.client.model.config;
-
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-
-/**
- * Represents an individual transformer option or group of options that are required or optional (default).
- */
-@JsonTypeInfo(
- use = JsonTypeInfo.Id.NAME,
- include = JsonTypeInfo.As.WRAPPER_OBJECT)
-@JsonSubTypes({
- @JsonSubTypes.Type(value = TransformOptionValue.class, name = "value"),
- @JsonSubTypes.Type(value = TransformOptionGroup.class, name = "group")
-})
-public interface TransformOption
-{
- boolean isRequired();
- void setRequired(boolean required);
-}
diff --git a/src/main/java/org/alfresco/transform/client/model/config/TransformOptionGroup.java b/src/main/java/org/alfresco/transform/client/model/config/TransformOptionGroup.java
deleted file mode 100644
index a0ad82c951..0000000000
--- a/src/main/java/org/alfresco/transform/client/model/config/TransformOptionGroup.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2018 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.transform.client.model.config;
-
-import java.util.List;
-
-/**
- * Represents a group of one or more options. If the group is optional, child options that are marked as required are
- * only required if any child in the group is supplied by the client. If the group is required, child options are
- * optional or required based on their own setting alone.
- *
- * In a pipeline transformation, a group of options
- */
-public class TransformOptionGroup extends AbstractTransformOption
-{
- List transformOptions;
-
- public TransformOptionGroup()
- {
- }
-
- public TransformOptionGroup(boolean required, List transformOptions)
- {
- setRequired(required);
- setTransformOptions(transformOptions);
- }
-
- public List getTransformOptions()
- {
- return transformOptions;
- }
-
- public void setTransformOptions(List transformOptions)
- {
- this.transformOptions = transformOptions;
- }
-}
diff --git a/src/main/java/org/alfresco/transform/client/model/config/TransformOptionValue.java b/src/main/java/org/alfresco/transform/client/model/config/TransformOptionValue.java
deleted file mode 100644
index 6962162175..0000000000
--- a/src/main/java/org/alfresco/transform/client/model/config/TransformOptionValue.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2018 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.transform.client.model.config;
-
-/**
- * Represents a single transformation option.
- */
-public class TransformOptionValue extends AbstractTransformOption
-{
- private String name;
-
- public TransformOptionValue()
- {
- }
-
- public TransformOptionValue(boolean required, String name)
- {
- setRequired(required);
- setName(name);
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-}
diff --git a/src/main/java/org/alfresco/transform/client/model/config/TransformServiceRegistryImpl.java b/src/main/java/org/alfresco/transform/client/model/config/TransformServiceRegistryImpl.java
index 78310f196d..51d3d78cda 100644
--- a/src/main/java/org/alfresco/transform/client/model/config/TransformServiceRegistryImpl.java
+++ b/src/main/java/org/alfresco/transform/client/model/config/TransformServiceRegistryImpl.java
@@ -39,10 +39,14 @@ import java.io.Reader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean;
import static org.alfresco.repo.rendition2.RenditionDefinition2.TIMEOUT;
@@ -73,7 +77,7 @@ public abstract class TransformServiceRegistryImpl implements TransformServiceRe
private String name;
private int priority;
- public SupportedTransform(Data data, String name, List transformOptions, long maxSourceSizeBytes, int priority)
+ public SupportedTransform(Data data, String name, Set transformOptions, long maxSourceSizeBytes, int priority)
{
// Logically the top level TransformOptionGroup is required, so that child options are optional or required
// based on their own setting.
@@ -180,11 +184,11 @@ public abstract class TransformServiceRegistryImpl implements TransformServiceRe
public void register(Reader reader, String readFrom) throws IOException
{
- List transformers = jsonObjectMapper.readValue(reader, new TypeReference>(){});
+ List transformers = jsonObjectMapper.readValue(reader, new TypeReference>(){});
transformers.forEach(t -> register(t, null, readFrom));
}
- protected void register(Transformer transformer, String baseUrl, String readFrom)
+ protected void register(InlineTransformer transformer, String baseUrl, String readFrom)
{
Data data = getData();
data.transformerCount++;
@@ -364,7 +368,7 @@ public abstract class TransformServiceRegistryImpl implements TransformServiceRe
boolean added = false;
boolean required = false;
- List optionList = transformOptionGroup.getTransformOptions();
+ Set optionList = transformOptionGroup.getTransformOptions();
if (optionList != null && !optionList.isEmpty())
{
// We need to avoid adding options from a group that is required but its parents are not.
diff --git a/src/main/java/org/alfresco/transform/client/model/config/TransformStep.java b/src/main/java/org/alfresco/transform/client/model/config/TransformStep.java
deleted file mode 100644
index cd2a543174..0000000000
--- a/src/main/java/org/alfresco/transform/client/model/config/TransformStep.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2019 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.transform.client.model.config;
-
-/**
- * Represents a single transform step in a transform pipeline. The last step in the pipeline does not specify the
- * target type as that is based on the supported types and what has been requested.
- */
-public class TransformStep
-{
- private String transformerName;
- private String targetMediaType;
-
- public TransformStep()
- {
- }
-
- public TransformStep(String transformerName, String targetMediaType)
- {
- setTransformerName(transformerName);
- setTargetMediaType(targetMediaType);
- }
-
- public String getTransformerName()
- {
- return transformerName;
- }
-
- public void setTransformerName(String transformerName)
- {
- this.transformerName = transformerName;
- }
-
- public String getTargetMediaType()
- {
- return targetMediaType;
- }
-
- public void setTargetMediaType(String targetMediaType)
- {
- this.targetMediaType = targetMediaType;
- }
-}
diff --git a/src/main/java/org/alfresco/transform/client/model/config/Transformer.java b/src/main/java/org/alfresco/transform/client/model/config/Transformer.java
deleted file mode 100644
index f707d1cc95..0000000000
--- a/src/main/java/org/alfresco/transform/client/model/config/Transformer.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2019 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.transform.client.model.config;
-
-import java.util.List;
-import org.alfresco.transform.client.model.config.TransformServiceRegistry;
-
-/**
- * Represents a set of transformations supported by the Transform Service or Local Transform Service Registry that
- * share the same transform options. Each may be an actual transformer or a pipeline of multiple transformers. It is
- * possible that more than one transformer may able to perform a transformation from one mimetype to another. The actual
- * selection of transformer is up to the Transform Service or Local Transform Service Registry to decide. Clients may
- * use {@link TransformServiceRegistry#isSupported(String, long, String, java.util.Map, String)} to decide
- * if they should send a request to the Transform Service. As a result clients have a simple generic view of
- * transformations which allows new transformations to be added without the need to change client data structures other
- * than to define new name value pairs. For this to work the Transform Service defines unique names for each option.
- *
- * - transformerName - is optional but if supplied should be unique. The client should infer nothing from the name
- * as it is simply a label, but the Local Transform Service Registry will use the name in pipelines.
- * - transformOptions - a grouping of individual transformer transformOptions. The group may be optional and may
- * contain nested transformOptions.
- *
- * For local transforms, this structure is extended when defining a pipeline transform.
- *
- * - transformerPipeline - an array of pairs of transformer name and target extension for each transformer in the
- * pipeline. The last one should not have an extension as that is defined by the request and should be in the
- * supported list.
- *
- */
-public class Transformer
-{
- private String transformerName;
- private List transformerPipeline;
- private List transformOptions;
- private List supportedSourceAndTargetList;
-
- public Transformer()
- {
- }
-
- public Transformer(String transformerName, List transformOptions, List supportedSourceAndTargetList)
- {
- setTransformerName(transformerName);
- setTransformOptions(transformOptions);
- setSupportedSourceAndTargetList(supportedSourceAndTargetList);
- }
-
- public Transformer(String transformerName, List transformerPipeline, List transformOptions, List supportedSourceAndTargetList)
- {
- this(transformerName, transformOptions, supportedSourceAndTargetList);
- setTransformerPipeline(transformerPipeline);
- }
-
- public String getTransformerName()
- {
- return transformerName;
- }
-
- public void setTransformerName(String transformerName)
- {
- this.transformerName = transformerName;
- }
-
- public List getTransformerPipeline()
- {
- return transformerPipeline;
- }
-
- public void setTransformerPipeline(List transformerPipeline)
- {
- this.transformerPipeline = transformerPipeline;
- }
-
- public List getTransformOptions()
- {
- return transformOptions;
- }
-
- public void setTransformOptions(List transformOptions)
- {
- this.transformOptions = transformOptions;
- }
-
- public List getSupportedSourceAndTargetList()
- {
- return supportedSourceAndTargetList;
- }
-
- public void setSupportedSourceAndTargetList(List supportedSourceAndTargetList)
- {
- this.supportedSourceAndTargetList = supportedSourceAndTargetList;
- }
-}
diff --git a/src/test/java/org/alfresco/transform/client/model/config/LocalTransformServiceRegistryConfigTest.java b/src/test/java/org/alfresco/transform/client/model/config/LocalTransformServiceRegistryConfigTest.java
index ad0d5396ae..4a9bc1aa9f 100644
--- a/src/test/java/org/alfresco/transform/client/model/config/LocalTransformServiceRegistryConfigTest.java
+++ b/src/test/java/org/alfresco/transform/client/model/config/LocalTransformServiceRegistryConfigTest.java
@@ -282,7 +282,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformServiceReg
officeToImageViaPdfSupportedTransformation.put("application/vnd.ms-outlook", targetMimetype);
}
- protected String getBaseUrl(Transformer transformer)
+ protected String getBaseUrl(InlineTransformer transformer)
{
return LOCAL_TRANSFORM+transformer.getTransformerName()+".url";
}
@@ -319,7 +319,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformServiceReg
case "imagemagick":
assertEquals(t.transform.getTransformerName() + " incorrect number of supported transform", 14, t.transform.getSupportedSourceAndTargetList().size());
assertEquals( t.transform.getTransformerName() + "incorrect number of transform options", 6, t.transform.getTransformOptions().size());
- assertNull(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline());
+ assertEquals(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline().size(), 0);
//Test supportedSourceAndTargetList
for ( SupportedSourceAndTarget ssat: t.transform.getSupportedSourceAndTargetList())
@@ -332,7 +332,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformServiceReg
case "tika":
assertEquals(t.transform.getTransformerName() + " incorrect number of supported transform", 8, t.transform.getSupportedSourceAndTargetList().size());
assertEquals( t.transform.getTransformerName() + "incorrect number of transform options", 5, t.transform.getTransformOptions().size());
- assertNull(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline());
+ assertEquals(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline().size(), 0);
//Test supportedSourceAndTargetList
for ( SupportedSourceAndTarget ssat: t.transform.getSupportedSourceAndTargetList())
@@ -345,7 +345,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformServiceReg
case "pdfrenderer":
assertEquals(t.transform.getTransformerName() + " incorrect number of supported transform", 1, t.transform.getSupportedSourceAndTargetList().size());
assertEquals( t.transform.getTransformerName() + "incorrect number of transform options", 5, t.transform.getTransformOptions().size());
- assertNull(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline());
+ assertEquals(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline().size(), 0);
//Test supportedSourceAndTargetList
for ( SupportedSourceAndTarget ssat: t.transform.getSupportedSourceAndTargetList())
@@ -357,8 +357,8 @@ public class LocalTransformServiceRegistryConfigTest extends TransformServiceReg
case "libreoffice":
assertEquals(t.transform.getTransformerName() + " incorrect number of supported transform", 9, t.transform.getSupportedSourceAndTargetList().size());
- assertNull( t.transform.getTransformerName() + "incorrect number of transform options", t.transform.getTransformOptions());
- assertNull(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline());
+ assertEquals( t.transform.getTransformerName() + "incorrect number of transform options", t.transform.getTransformOptions().size(), 0);
+ assertEquals(t.transform.getTransformerName() + " expected to not be a transformer pipeline", t.transform.getTransformerPipeline().size(), 0);
//Test supportedSourceAndTargetList
for ( SupportedSourceAndTarget ssat: t.transform.getSupportedSourceAndTargetList())
@@ -371,7 +371,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformServiceReg
case "officeToImageViaPdf":
assertEquals(t.transform.getTransformerName() + " incorrect number of supported transform", 28, t.transform.getSupportedSourceAndTargetList().size());
assertEquals( t.transform.getTransformerName() + "incorrect number of transform options", 2, t.transform.getTransformOptions().size());
- assertNotNull(t.transform.getTransformerName() + " expected to be a transformer pipeline", t.transform.getTransformerPipeline());
+ assertEquals(t.transform.getTransformerName() + " expected to be a transformer pipeline", t.transform.getTransformerPipeline().size(), 3);
//Test supportedSourceAndTargetList
for ( SupportedSourceAndTarget ssat: t.transform.getSupportedSourceAndTargetList())
diff --git a/src/test/java/org/alfresco/transform/client/model/config/TransformBuilder.java b/src/test/java/org/alfresco/transform/client/model/config/TransformBuilder.java
index a9d9316df9..1cd65aed9d 100644
--- a/src/test/java/org/alfresco/transform/client/model/config/TransformBuilder.java
+++ b/src/test/java/org/alfresco/transform/client/model/config/TransformBuilder.java
@@ -26,18 +26,20 @@
package org.alfresco.transform.client.model.config;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
- * Helper class that builds a {@link Transformer} given the source and target types and a pipeline of Transformers
+ * Helper class that builds a {@link InlineTransformer} given the source and target types and a pipeline of Transformers
* for creating intermediary content.
*/
public class TransformBuilder
{
- public Transformer buildPipeLine(String name, List sourceAndTargetList,
+ public InlineTransformer buildPipeLine(String name, Set sourceAndTargetList,
List transformerList)
{
- List options = new ArrayList<>(transformerList.size());
+ Set options = new HashSet<>(transformerList.size());
transformerList.forEach(t ->
{
// Avoid creating an enpty TransformOptionGroup if the transformer has no options.
@@ -47,6 +49,6 @@ public class TransformBuilder
options.add(new TransformOptionGroup(t.isRequired(), t.getTransformer().getTransformOptions()));
}
});
- return new Transformer(name, options, sourceAndTargetList);
+ return new InlineTransformer(name, options, sourceAndTargetList);
}
}
diff --git a/src/test/java/org/alfresco/transform/client/model/config/TransformServiceRegistryConfigTest.java b/src/test/java/org/alfresco/transform/client/model/config/TransformServiceRegistryConfigTest.java
index 6abfecd002..80f0e84c76 100644
--- a/src/test/java/org/alfresco/transform/client/model/config/TransformServiceRegistryConfigTest.java
+++ b/src/test/java/org/alfresco/transform/client/model/config/TransformServiceRegistryConfigTest.java
@@ -41,14 +41,18 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -79,7 +83,7 @@ public class TransformServiceRegistryConfigTest
private TransformServiceRegistryImpl registry;
protected TransformBuilder builder;
- protected Transformer transformer;
+ protected InlineTransformer transformer;
@Before
public void setUp() throws Exception
@@ -176,11 +180,11 @@ public class TransformServiceRegistryConfigTest
}
}
- private void assertTransformOptions(List transformOptions) throws Exception
+ private void assertTransformOptions(Set transformOptions) throws Exception
{
- transformer = new Transformer("name",
+ transformer = new InlineTransformer("name",
transformOptions,
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, TXT, -1),
new SupportedSourceAndTarget(XLS, TXT, 1024000)));
@@ -193,14 +197,14 @@ public class TransformServiceRegistryConfigTest
assertTrue(registry.isSupported(DOC, 1024001, TXT, null, null));
}
- protected String getBaseUrl(Transformer transformer)
+ protected String getBaseUrl(InlineTransformer transformer)
{
return null;
}
private void assertTransformerName(String sourceMimetype, long sourceSizeInBytes, String targetMimetype,
Map actualOptions, String expectedTransformerName,
- Transformer... transformers) throws Exception
+ InlineTransformer... transformers) throws Exception
{
buildAndPopulateRegistry(transformers);
String transformerName = registry.getTransformerName(sourceMimetype, sourceSizeInBytes, targetMimetype, actualOptions, null);
@@ -215,16 +219,16 @@ public class TransformServiceRegistryConfigTest
private void assertSupported(String sourceMimetype, long sourceSizeInBytes, String targetMimetype,
Map actualOptions, String unsupportedMsg,
- Transformer... transformers) throws Exception
+ InlineTransformer... transformers) throws Exception
{
buildAndPopulateRegistry(transformers);
assertSupported(sourceMimetype, sourceSizeInBytes, targetMimetype, actualOptions, null, unsupportedMsg);
}
- private void buildAndPopulateRegistry(Transformer[] transformers) throws Exception
+ private void buildAndPopulateRegistry(InlineTransformer[] transformers) throws Exception
{
registry = buildTransformServiceRegistryImpl();
- for (Transformer transformer : transformers)
+ for (InlineTransformer transformer : transformers)
{
registry.register(transformer, getBaseUrl(transformer), getClass().getName());
}
@@ -266,56 +270,56 @@ public class TransformServiceRegistryConfigTest
@Test
public void testReadWriteJson() throws IOException
{
- Transformer libreoffice = new Transformer("libreoffice",
+ InlineTransformer libreoffice = new InlineTransformer("libreoffice",
null, // there are no options
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, PDF, -1),
new SupportedSourceAndTarget(XLS, PDF, 1024000),
new SupportedSourceAndTarget(PPT, PDF, -1),
new SupportedSourceAndTarget(MSG, PDF, -1)));
- Transformer pdfrenderer = new Transformer("pdfrenderer",
- Arrays.asList(
+ InlineTransformer pdfrenderer = new InlineTransformer("pdfrenderer",
+ Set.of(
new TransformOptionValue(false, "page"),
new TransformOptionValue(false, "width"),
new TransformOptionValue(false, "height"),
new TransformOptionValue(false, "allowPdfEnlargement"),
new TransformOptionValue(false, "maintainPdfAspectRatio")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(PDF, PNG, -1)));
- Transformer tika = new Transformer("tika",
- Arrays.asList(
+ InlineTransformer tika = new InlineTransformer("tika",
+ Set.of(
new TransformOptionValue(false, "transform"),
new TransformOptionValue(false, "includeContents"),
new TransformOptionValue(false, "notExtractBookmarksText"),
new TransformOptionValue(false, "targetMimetype"),
new TransformOptionValue(false, "targetEncoding")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(PDF, TXT, -1),
new SupportedSourceAndTarget(DOC, TXT, -1),
new SupportedSourceAndTarget(XLS, TXT, 1024000),
new SupportedSourceAndTarget(PPT, TXT, -1),
new SupportedSourceAndTarget(MSG, TXT, -1)));
- Transformer imagemagick = new Transformer("imagemagick",
- Arrays.asList(
+ InlineTransformer imagemagick = new InlineTransformer("imagemagick",
+ Set.of(
new TransformOptionValue(false, "alphaRemove"),
new TransformOptionValue(false, "autoOrient"),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "cropGravity"),
new TransformOptionValue(false, "cropWidth"),
new TransformOptionValue(false, "cropHeight"),
new TransformOptionValue(false, "cropPercentage"),
new TransformOptionValue(false, "cropXOffset"),
new TransformOptionValue(false, "cropYOffset"))),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "thumbnail"),
new TransformOptionValue(false, "resizeHeight"),
new TransformOptionValue(false, "resizeWidth"),
new TransformOptionValue(false, "resizePercentage"),
new TransformOptionValue(false, "maintainAspectRatio")))),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(GIF, GIF, -1),
new SupportedSourceAndTarget(GIF, JPEG, -1),
new SupportedSourceAndTarget(GIF, PNG, -1),
@@ -336,8 +340,8 @@ public class TransformServiceRegistryConfigTest
new SupportedSourceAndTarget(TIFF, PNG, -1),
new SupportedSourceAndTarget(TIFF, TIFF, -1)));
- Transformer officeToImage = builder.buildPipeLine("transformer1",
- Arrays.asList(
+ InlineTransformer officeToImage = builder.buildPipeLine("transformer1",
+ Set.of(
new SupportedSourceAndTarget(DOC, GIF, -1),
new SupportedSourceAndTarget(DOC, JPEG, -1),
new SupportedSourceAndTarget(DOC, PNG, -1),
@@ -359,7 +363,7 @@ public class TransformServiceRegistryConfigTest
new ChildTransformer(false, pdfrenderer), // to png
new ChildTransformer(true, imagemagick))); // to other image formats
- List transformers1 = Arrays.asList(libreoffice, tika, pdfrenderer, imagemagick, officeToImage);
+ List transformers1 = Arrays.asList(libreoffice, tika, pdfrenderer, imagemagick, officeToImage);
File tempFile = File.createTempFile("test", ".json");
ObjectMapper objectMapper = new ObjectMapper();
@@ -433,13 +437,35 @@ public class TransformServiceRegistryConfigTest
List supportedTransforms = transformsToWord.get(GIF);
TransformServiceRegistryImpl.SupportedTransform supportedTransform = supportedTransforms.get(0);
- TransformOptionGroup imagemagick = (TransformOptionGroup)supportedTransform.transformOptions.transformOptions.get(0);
- TransformOptionGroup pdf = (TransformOptionGroup)supportedTransform.transformOptions.transformOptions.get(1);
+ Set transformOptionsSet = supportedTransform.transformOptions.getTransformOptions();
+ System.out.println("Nothing");
- TransformOptionValue alphaRemove = (TransformOptionValue)imagemagick.transformOptions.get(0);
- TransformOptionGroup crop = (TransformOptionGroup)imagemagick.transformOptions.get(4);
- TransformOptionValue cropGravity = (TransformOptionValue)crop.transformOptions.get(0);
- TransformOptionValue cropWidth = (TransformOptionValue)crop.transformOptions.get(1);
+ Iterator iterator = transformOptionsSet.iterator();
+ assertTrue("Expected transform values", iterator.hasNext());
+ // Because Set is unordered we don't know which TransformOptionGroup we retrieve
+ TransformOptionGroup transformOptions1 = (TransformOptionGroup)iterator.next();
+
+ assertTrue("Expected transform values", iterator.hasNext());
+ TransformOptionGroup transformOptions2 = (TransformOptionGroup)iterator.next();
+
+ TransformOptionGroup imagemagick;
+ TransformOptionGroup pdf;
+
+ if(containsTransformOptionValueName(transformOptions1, "alphaRemove"))
+ {
+ imagemagick = transformOptions1;
+ pdf = transformOptions2;
+ }
+ else
+ {
+ imagemagick = transformOptions2;
+ pdf = transformOptions1;
+ }
+
+ TransformOptionValue alphaRemove = (TransformOptionValue)retrieveTransformOptionByPropertyName(imagemagick, "alphaRemove", "TransformOptionValue");
+ TransformOptionGroup crop = (TransformOptionGroup)retrieveTransformOptionByPropertyName(imagemagick, "crop", "TransformOptionGroup");
+ TransformOptionValue cropGravity = (TransformOptionValue)retrieveTransformOptionByPropertyName(crop, "cropGravity", "TransformOptionValue");
+ TransformOptionValue cropWidth = (TransformOptionValue)retrieveTransformOptionByPropertyName(crop, "cropWidth", "TransformOptionValue");
assertTrue("The holding group should be required", supportedTransform.transformOptions.isRequired());
assertFalse("imagemagick should be optional as it is not set", imagemagick.isRequired());
@@ -467,6 +493,56 @@ public class TransformServiceRegistryConfigTest
assertSupported(DOC,1234, PNG, actualOptions, null, "");
}
+ private TransformOption retrieveTransformOptionByPropertyName (TransformOptionGroup transformOptionGroup, String propertyName, String propertyType)
+ {
+ Iterator iterator = transformOptionGroup.getTransformOptions().iterator();
+
+ List transformOptionsList = new ArrayList<>();
+ while(iterator.hasNext())
+ {
+ transformOptionsList.add(iterator.next());
+ }
+
+ for (TransformOption t : transformOptionsList)
+ {
+ if (t instanceof TransformOptionValue)
+ {
+ TransformOptionValue value = (TransformOptionValue) t;
+ if (propertyType.equalsIgnoreCase("TransformOptionValue"))
+ {
+ if (value.getName().equalsIgnoreCase(propertyName))
+ return value;
+ }
+ else
+ {
+ if (value.getName().contains(propertyName))
+ return transformOptionGroup;
+ }
+ }
+ else
+ {
+ TransformOption result = retrieveTransformOptionByPropertyName((TransformOptionGroup)t, propertyName, propertyType);
+ if (result != null)
+ return result;
+ }
+ }
+ return null;
+ }
+
+ private boolean containsTransformOptionValueName (TransformOptionGroup transformOptionGroup, String propertyName)
+ {
+ if (retrieveTransformOptionByPropertyName(transformOptionGroup, propertyName, "TransformOptionValue") != null)
+ return true;
+ return false;
+ }
+
+ private boolean containsTransformOptionGroupeName (TransformOptionGroup transformOptionGroup, String propertyName)
+ {
+ if (retrieveTransformOptionByPropertyName(transformOptionGroup, propertyName, "TransformOptionGroup") != null)
+ return true;
+ return false;
+ }
+
protected int getExpectedTransformsForTestJsonPipeline()
{
return 4;
@@ -491,14 +567,14 @@ public class TransformServiceRegistryConfigTest
public void testOptionalGroups()
{
TransformOptionGroup transformOptionGroup =
- new TransformOptionGroup(true, Arrays.asList(
+ new TransformOptionGroup(true, Set.of(
new TransformOptionValue(false, "1"),
new TransformOptionValue(true, "2"),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "3.1"),
new TransformOptionValue(false, "3.2"),
new TransformOptionValue(false, "3.3"))),
- new TransformOptionGroup(false, Arrays.asList( // OPTIONAL
+ new TransformOptionGroup(false, Set.of( // OPTIONAL
new TransformOptionValue(false, "4.1"),
new TransformOptionValue(true, "4.2"),
new TransformOptionValue(false, "4.3")))));
@@ -515,14 +591,14 @@ public class TransformServiceRegistryConfigTest
public void testRequiredGroup()
{
TransformOptionGroup transformOptionGroup =
- new TransformOptionGroup(true, Arrays.asList(
+ new TransformOptionGroup(true, Set.of(
new TransformOptionValue(false, "1"),
new TransformOptionValue(true, "2"),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "3.1"),
new TransformOptionValue(false, "3.2"),
new TransformOptionValue(false, "3.3"))),
- new TransformOptionGroup(true, Arrays.asList( // REQUIRED
+ new TransformOptionGroup(true, Set.of( // REQUIRED
new TransformOptionValue(false, "4.1"),
new TransformOptionValue(true, "4.2"),
new TransformOptionValue(false, "4.3")))));
@@ -538,49 +614,49 @@ public class TransformServiceRegistryConfigTest
public void testNesstedGrpups()
{
TransformOptionGroup transformOptionGroup =
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "1"),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "1.2"),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "1.2.3"))))))),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "2"),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "2.2"),
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "2.2.1.2"))))))))),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(true, "3"), // REQUIRED
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "3.1.1.2"))))))))),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "4"),
- new TransformOptionGroup(true, Arrays.asList( // REQUIRED
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(true, Set.of( // REQUIRED
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "4.1.1.2"))))))))),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "5"),
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(true, Arrays.asList( // REQUIRED
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(true, Set.of( // REQUIRED
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "5.1.1.2"))))))))),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "6"),
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(true, Arrays.asList( // REQUIRED
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(true, Set.of( // REQUIRED
new TransformOptionValue(false, "6.1.1.2"))))))))),
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(false, "7"),
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
- new TransformOptionGroup(false, Arrays.asList(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
+ new TransformOptionGroup(false, Set.of(
new TransformOptionValue(true, "7.1.1.2"))))))))) // REQUIRED
));
@@ -624,7 +700,7 @@ public class TransformServiceRegistryConfigTest
@Test
public void testNoActualOptions() throws Exception
{
- assertTransformOptions(Arrays.asList(
+ assertTransformOptions(Set.of(
new TransformOptionValue(false, "option1"),
new TransformOptionValue(false, "option2")));
}
@@ -632,19 +708,19 @@ public class TransformServiceRegistryConfigTest
@Test
public void testNoTrasformOptions() throws Exception
{
- assertTransformOptions(Collections.emptyList());
+ assertTransformOptions(Collections.emptySet());
assertTransformOptions(null);
}
@Test
public void testSupported() throws Exception
{
- transformer = new Transformer("name",
- Arrays.asList(
+ transformer = new InlineTransformer("name",
+ Set.of(
new TransformOptionValue(false, "page"),
new TransformOptionValue(false, "width"),
new TransformOptionValue(false, "height")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, GIF, 102400),
new SupportedSourceAndTarget(DOC, JPEG, -1),
new SupportedSourceAndTarget(MSG, GIF, -1)));
@@ -665,12 +741,12 @@ public class TransformServiceRegistryConfigTest
public void testCache()
{
// Note: transformNames are an alias for a set of actualOptions and the target mimetpe. The source mimetype may change.
- transformer = new Transformer("name",
- Arrays.asList(
+ transformer = new InlineTransformer("name",
+ Set.of(
new TransformOptionValue(false, "page"),
new TransformOptionValue(false, "width"),
new TransformOptionValue(false, "height")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, GIF, 102400),
new SupportedSourceAndTarget(MSG, GIF, -1)));
@@ -691,16 +767,16 @@ public class TransformServiceRegistryConfigTest
@Test
public void testGetTransformerName() throws Exception
{
- Transformer t1 = new Transformer("transformer1", null,
- Arrays.asList(new SupportedSourceAndTarget(MSG, GIF, 100, 50)));
- Transformer t2 = new Transformer("transformer2", null,
- Arrays.asList(new SupportedSourceAndTarget(MSG, GIF, 200, 60)));
- Transformer t3 = new Transformer("transformer3", null,
- Arrays.asList(new SupportedSourceAndTarget(MSG, GIF, 200, 40)));
- Transformer t4 = new Transformer("transformer4", null,
- Arrays.asList(new SupportedSourceAndTarget(MSG, GIF, -1, 100)));
- Transformer t5 = new Transformer("transformer5", null,
- Arrays.asList(new SupportedSourceAndTarget(MSG, GIF, -1, 80)));
+ InlineTransformer t1 = new InlineTransformer("transformer1", null,
+ Set.of(new SupportedSourceAndTarget(MSG, GIF, 100, 50)));
+ InlineTransformer t2 = new InlineTransformer("transformer2", null,
+ Set.of(new SupportedSourceAndTarget(MSG, GIF, 200, 60)));
+ InlineTransformer t3 = new InlineTransformer("transformer3", null,
+ Set.of(new SupportedSourceAndTarget(MSG, GIF, 200, 40)));
+ InlineTransformer t4 = new InlineTransformer("transformer4", null,
+ Set.of(new SupportedSourceAndTarget(MSG, GIF, -1, 100)));
+ InlineTransformer t5 = new InlineTransformer("transformer5", null,
+ Set.of(new SupportedSourceAndTarget(MSG, GIF, -1, 80)));
Map actualOptions = null;
@@ -722,28 +798,28 @@ public class TransformServiceRegistryConfigTest
@Test
public void testMultipleTransformers() throws Exception
{
- Transformer transformer1 = new Transformer("transformer1",
- Arrays.asList(
+ InlineTransformer transformer1 = new InlineTransformer("transformer1",
+ Set.of(
new TransformOptionValue(false, "page"),
new TransformOptionValue(false, "width"),
new TransformOptionValue(false, "height")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, GIF, 102400),
new SupportedSourceAndTarget(DOC, JPEG, -1),
new SupportedSourceAndTarget(MSG, GIF, -1)));
- Transformer transformer2 = new Transformer("transformer2",
- Arrays.asList(
+ InlineTransformer transformer2 = new InlineTransformer("transformer2",
+ Set.of(
new TransformOptionValue(false, "opt1"),
new TransformOptionValue(false, "opt2")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(PDF, GIF, -1),
new SupportedSourceAndTarget(PPT, JPEG, -1)));
- Transformer transformer3 = new Transformer("transformer3",
- Arrays.asList(
+ InlineTransformer transformer3 = new InlineTransformer("transformer3",
+ Set.of(
new TransformOptionValue(false, "opt1")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, GIF, -1)));
Map actualOptions = null;
@@ -769,18 +845,18 @@ public class TransformServiceRegistryConfigTest
@Test
public void testPipeline() throws Exception
{
- Transformer transformer1 = new Transformer("transformer1",
+ InlineTransformer transformer1 = new InlineTransformer("transformer1",
null, // there are no options
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, PDF, -1),
new SupportedSourceAndTarget(MSG, PDF, -1)));
- Transformer transformer2 = new Transformer("transformer2",
- Arrays.asList(
+ InlineTransformer transformer2 = new InlineTransformer("transformer2",
+ Set.of(
new TransformOptionValue(false, "page"),
new TransformOptionValue(false, "width"),
new TransformOptionValue(false, "height")),
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(PDF, GIF, -1),
new SupportedSourceAndTarget(PDF, JPEG, -1)));
@@ -797,7 +873,7 @@ public class TransformServiceRegistryConfigTest
assertSupported(DOC, 1024, GIF, buildActualOptions("page, width, startPage"), "startPage is not an option");
// Add options to the first transformer
- transformer1.setTransformOptions(Arrays.asList(
+ transformer1.setTransformOptions(Set.of(
new TransformOptionValue(false, "startPage"),
new TransformOptionValue(false, "endPage")));
buildPipelineTransformer(transformer1, transformer2);
@@ -806,10 +882,10 @@ public class TransformServiceRegistryConfigTest
assertSupported(DOC, 1024, GIF, buildActualOptions("page, width, startPage"), null);
}
- private void buildPipelineTransformer(Transformer transformer1, Transformer transformer2)
+ private void buildPipelineTransformer(InlineTransformer transformer1, InlineTransformer transformer2)
{
transformer = builder.buildPipeLine("transformer1",
- Arrays.asList(
+ Set.of(
new SupportedSourceAndTarget(DOC, GIF, -1),
new SupportedSourceAndTarget(DOC, JPEG, -1),
new SupportedSourceAndTarget(MSG, GIF, -1)),