mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
CE-2261: removed depricated calls with actionInput
This commit is contained in:
@ -27,7 +27,6 @@ import java.util.Map;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.AbstractQActionFunction;
|
import com.kingsrook.qqq.backend.core.actions.AbstractQActionFunction;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.AbstractActionInput;
|
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.templates.RenderTemplateInput;
|
import com.kingsrook.qqq.backend.core.model.actions.templates.RenderTemplateInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.templates.RenderTemplateOutput;
|
import com.kingsrook.qqq.backend.core.model.actions.templates.RenderTemplateOutput;
|
||||||
import com.kingsrook.qqq.backend.core.model.templates.TemplateType;
|
import com.kingsrook.qqq.backend.core.model.templates.TemplateType;
|
||||||
@ -107,7 +106,7 @@ public class RenderTemplateAction extends AbstractQActionFunction<RenderTemplate
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Most convenient static wrapper to render a Velocity template.
|
** Most convenient static wrapper to render a Velocity template.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public static String renderVelocity(AbstractActionInput parentActionInput, Map<String, Object> context, String code) throws QException
|
public static String renderVelocity(Map<String, Object> context, String code) throws QException
|
||||||
{
|
{
|
||||||
return (render(TemplateType.VELOCITY, context, code));
|
return (render(TemplateType.VELOCITY, context, code));
|
||||||
}
|
}
|
||||||
|
@ -66,16 +66,14 @@ public class RenderTemplateActionTest extends BaseTest
|
|||||||
@Test
|
@Test
|
||||||
void testConvenientWrapper() throws QException
|
void testConvenientWrapper() throws QException
|
||||||
{
|
{
|
||||||
RenderTemplateInput parentActionInput = new RenderTemplateInput();
|
|
||||||
|
|
||||||
String template = "Hello, $name";
|
String template = "Hello, $name";
|
||||||
assertEquals("Hello, Darin", RenderTemplateAction.renderVelocity(parentActionInput, Map.of("name", "Darin"), template));
|
assertEquals("Hello, Darin", RenderTemplateAction.renderVelocity(Map.of("name", "Darin"), template));
|
||||||
assertEquals("Hello, Tim", RenderTemplateAction.renderVelocity(parentActionInput, Map.of("name", "Tim"), template));
|
assertEquals("Hello, Tim", RenderTemplateAction.renderVelocity(Map.of("name", "Tim"), template));
|
||||||
assertEquals("Hello, $name", RenderTemplateAction.renderVelocity(parentActionInput, Map.of(), template));
|
assertEquals("Hello, $name", RenderTemplateAction.renderVelocity(Map.of(), template));
|
||||||
|
|
||||||
template = "Hello, $!name";
|
template = "Hello, $!name";
|
||||||
assertEquals("Hello, ", RenderTemplateAction.renderVelocity(parentActionInput, Map.of(), template));
|
assertEquals("Hello, ", RenderTemplateAction.renderVelocity(Map.of(), template));
|
||||||
assertEquals("Hello, ", RenderTemplateAction.renderVelocity(parentActionInput, null, template));
|
assertEquals("Hello, ", RenderTemplateAction.renderVelocity(null, template));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user