Search in sources :

Example 1 with ActionDefinitionImpl

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));
}
Also used : ActionDefinitionImpl(org.alfresco.repo.action.ActionDefinitionImpl) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition)

Example 2 with ActionDefinitionImpl

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));
}
Also used : RenderingEngineDefinition(org.alfresco.service.cmr.rendition.RenderingEngineDefinition) ActionDefinitionImpl(org.alfresco.repo.action.ActionDefinitionImpl) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition) LinkedList(java.util.LinkedList)

Aggregations

ActionDefinitionImpl (org.alfresco.repo.action.ActionDefinitionImpl)2 ActionDefinition (org.alfresco.service.cmr.action.ActionDefinition)2 LinkedList (java.util.LinkedList)1 RenderingEngineDefinition (org.alfresco.service.cmr.rendition.RenderingEngineDefinition)1