use of org.alfresco.repo.action.ActionDefinitionImpl in project alfresco-repository by Alfresco.
the class RenditionServiceImplTest method testGetRenderingEngineDefinition.
public void testGetRenderingEngineDefinition() throws Exception {
// Check returns null when unknown name specified.
assertNull(renditionService.getRenderingEngineDefinition(""));
// Check returns null if action service returns an ActionDefinition
// which does not implement RenderingActionDefinition.
ActionDefinition actionDefinition = new ActionDefinitionImpl(ENGINE_NAME);
when(actionService.getActionDefinition(ENGINE_NAME)).thenReturn(actionDefinition);
assertNull(renditionService.getRenderingEngineDefinition(ENGINE_NAME));
// Check returns the definition if the action service returns an
// ActionDefinition
// which does implement RenderingActionDefinition.
ActionDefinition renderingDefinition = new RenderingEngineDefinitionImpl(ENGINE_NAME);
when(actionService.getActionDefinition(ENGINE_NAME)).thenReturn(renderingDefinition);
assertSame(renderingDefinition, renditionService.getRenderingEngineDefinition(ENGINE_NAME));
}
use of org.alfresco.repo.action.ActionDefinitionImpl in project alfresco-repository by Alfresco.
the class RenditionServiceImplTest method testGetRenderingEngineDefinitions.
public void testGetRenderingEngineDefinitions() throws Exception {
LinkedList<ActionDefinition> actionDefs = new LinkedList<ActionDefinition>();
when(actionService.getActionDefinitions()).thenReturn(actionDefs);
// Check case where no action definitions returned.
List<RenderingEngineDefinition> engineDefs = renditionService.getRenderingEngineDefinitions();
assertTrue("The list of rendering action definitions should be empty!", engineDefs.isEmpty());
// Check that when the action service returns a rendering engine
// definition then the rendering service includes this in the list of
// returned values.
ActionDefinition renderingDefinition = new RenderingEngineDefinitionImpl(ENGINE_NAME);
actionDefs.add(renderingDefinition);
engineDefs = renditionService.getRenderingEngineDefinitions();
assertEquals(1, engineDefs.size());
assertSame(renderingDefinition, engineDefs.get(0));
assertNotNull(renditionService.loadRenditionDefinitions(ENGINE_NAME));
// Check that when the action service returns a non-rendering action
// definition then the rendering service does not include it.
ActionDefinition actionDefinition = new ActionDefinitionImpl(ENGINE_NAME);
actionDefs.add(actionDefinition);
engineDefs = renditionService.getRenderingEngineDefinitions();
assertEquals(1, engineDefs.size());
assertSame(renderingDefinition, engineDefs.get(0));
}
Aggregations