Search in sources :

Example 1 with PresetProvider

use of org.opencastproject.presets.api.PresetProvider in project opencast by opencast.

the class DefaultsWorkflowOperationHandlerTest method usesOrganizationLevelPresetNullSeries.

@Test
public void usesOrganizationLevelPresetNullSeries() throws WorkflowOperationException, NotFoundException {
    Organization organization = EasyMock.createMock(Organization.class);
    EasyMock.replay(organization);
    String seriesID = null;
    presetProvider = EasyMock.createMock(PresetProvider.class);
    EasyMock.expect(presetProvider.getProperty(seriesID, OPT_KEY)).andReturn(ORGANIZATION_PRESET_VALUE);
    EasyMock.replay(presetProvider);
    // Workflow configuration
    Map<String, String> workflowConfiguration = new HashMap<String, String>();
    workflowConfiguration.put(OPT_KEY, WORKFLOW_PRESET_VALUE);
    WorkflowInstance workflowInstance = setupInstance(organization, seriesID, workflowConfiguration, false);
    DefaultsWorkflowOperationHandler handler = new DefaultsWorkflowOperationHandler();
    handler.setPresetProvider(presetProvider);
    WorkflowOperationResult result = handler.start(workflowInstance, null);
    assertEquals(ORGANIZATION_PRESET_VALUE, result.getProperties().get(OPT_KEY));
}
Also used : Organization(org.opencastproject.security.api.Organization) PresetProvider(org.opencastproject.presets.api.PresetProvider) HashMap(java.util.HashMap) WorkflowInstance(org.opencastproject.workflow.api.WorkflowInstance) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Example 2 with PresetProvider

use of org.opencastproject.presets.api.PresetProvider in project opencast by opencast.

the class DefaultsWorkflowOperationHandlerTest method usesOrganizationLevelPreset.

@Test
public void usesOrganizationLevelPreset() throws WorkflowOperationException, NotFoundException {
    Organization organization = EasyMock.createMock(Organization.class);
    EasyMock.replay(organization);
    String seriesID = "series-ID";
    presetProvider = EasyMock.createMock(PresetProvider.class);
    EasyMock.expect(presetProvider.getProperty(seriesID, OPT_KEY)).andReturn(ORGANIZATION_PRESET_VALUE);
    EasyMock.replay(presetProvider);
    // Workflow configuration
    Map<String, String> workflowConfiguration = new HashMap<String, String>();
    workflowConfiguration.put(OPT_KEY, WORKFLOW_PRESET_VALUE);
    WorkflowInstance workflowInstance = setupInstance(organization, seriesID, workflowConfiguration, false);
    DefaultsWorkflowOperationHandler handler = new DefaultsWorkflowOperationHandler();
    handler.setPresetProvider(presetProvider);
    WorkflowOperationResult result = handler.start(workflowInstance, null);
    assertEquals(ORGANIZATION_PRESET_VALUE, result.getProperties().get(OPT_KEY));
}
Also used : Organization(org.opencastproject.security.api.Organization) PresetProvider(org.opencastproject.presets.api.PresetProvider) HashMap(java.util.HashMap) WorkflowInstance(org.opencastproject.workflow.api.WorkflowInstance) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Example 3 with PresetProvider

use of org.opencastproject.presets.api.PresetProvider in project opencast by opencast.

the class DefaultsWorkflowOperationHandlerTest method usesWorkflowLevelPresetDueToNotFound.

@Test
public void usesWorkflowLevelPresetDueToNotFound() throws WorkflowOperationException, NotFoundException {
    Organization organization = EasyMock.createMock(Organization.class);
    EasyMock.replay(organization);
    String seriesID = "series-ID";
    presetProvider = EasyMock.createMock(PresetProvider.class);
    EasyMock.expect(presetProvider.getProperty(seriesID, OPT_KEY)).andThrow(new NotFoundException());
    EasyMock.replay(presetProvider);
    // Workflow configuration
    Map<String, String> workflowConfiguration = new HashMap<String, String>();
    workflowConfiguration.put(OPT_KEY, WORKFLOW_PRESET_VALUE);
    WorkflowInstance workflowInstance = setupInstance(organization, seriesID, workflowConfiguration, false);
    DefaultsWorkflowOperationHandler handler = new DefaultsWorkflowOperationHandler();
    handler.setPresetProvider(presetProvider);
    WorkflowOperationResult result = handler.start(workflowInstance, null);
    assertEquals(WORKFLOW_PRESET_VALUE, result.getProperties().get(OPT_KEY));
}
Also used : Organization(org.opencastproject.security.api.Organization) PresetProvider(org.opencastproject.presets.api.PresetProvider) HashMap(java.util.HashMap) NotFoundException(org.opencastproject.util.NotFoundException) WorkflowInstance(org.opencastproject.workflow.api.WorkflowInstance) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Example 4 with PresetProvider

use of org.opencastproject.presets.api.PresetProvider in project opencast by opencast.

the class DefaultsWorkflowOperationHandlerTest method usesSeriesLevelPreset.

@Test
public void usesSeriesLevelPreset() throws WorkflowOperationException, NotFoundException {
    Organization organization = EasyMock.createMock(Organization.class);
    EasyMock.replay(organization);
    String seriesID = "series-ID";
    presetProvider = EasyMock.createMock(PresetProvider.class);
    EasyMock.expect(presetProvider.getProperty(seriesID, OPT_KEY)).andReturn(SERIES_PRESET_VALUE);
    EasyMock.replay(presetProvider);
    // Workflow configuration
    Map<String, String> workflowConfiguration = new HashMap<String, String>();
    workflowConfiguration.put(OPT_KEY, WORKFLOW_PRESET_VALUE);
    WorkflowInstance workflowInstance = setupInstance(organization, seriesID, workflowConfiguration, false);
    DefaultsWorkflowOperationHandler handler = new DefaultsWorkflowOperationHandler();
    handler.setPresetProvider(presetProvider);
    WorkflowOperationResult result = handler.start(workflowInstance, null);
    assertEquals(SERIES_PRESET_VALUE, result.getProperties().get(OPT_KEY));
}
Also used : Organization(org.opencastproject.security.api.Organization) PresetProvider(org.opencastproject.presets.api.PresetProvider) HashMap(java.util.HashMap) WorkflowInstance(org.opencastproject.workflow.api.WorkflowInstance) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Example 5 with PresetProvider

use of org.opencastproject.presets.api.PresetProvider in project opencast by opencast.

the class DefaultsWorkflowOperationHandlerTest method usesWorkflowLevelPreset.

@Test
public void usesWorkflowLevelPreset() throws WorkflowOperationException, NotFoundException {
    Organization organization = EasyMock.createMock(Organization.class);
    EasyMock.replay(organization);
    String seriesID = "series-ID";
    presetProvider = EasyMock.createMock(PresetProvider.class);
    EasyMock.expect(presetProvider.getProperty(seriesID, OPT_KEY)).andReturn(null);
    EasyMock.replay(presetProvider);
    // Workflow configuration
    Map<String, String> workflowConfiguration = new HashMap<String, String>();
    workflowConfiguration.put(OPT_KEY, WORKFLOW_PRESET_VALUE);
    WorkflowInstance workflowInstance = setupInstance(organization, seriesID, workflowConfiguration, false);
    DefaultsWorkflowOperationHandler handler = new DefaultsWorkflowOperationHandler();
    handler.setPresetProvider(presetProvider);
    WorkflowOperationResult result = handler.start(workflowInstance, null);
    assertEquals(WORKFLOW_PRESET_VALUE, result.getProperties().get(OPT_KEY));
}
Also used : Organization(org.opencastproject.security.api.Organization) PresetProvider(org.opencastproject.presets.api.PresetProvider) HashMap(java.util.HashMap) WorkflowInstance(org.opencastproject.workflow.api.WorkflowInstance) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)5 Test (org.junit.Test)5 PresetProvider (org.opencastproject.presets.api.PresetProvider)5 Organization (org.opencastproject.security.api.Organization)5 WorkflowInstance (org.opencastproject.workflow.api.WorkflowInstance)5 WorkflowOperationResult (org.opencastproject.workflow.api.WorkflowOperationResult)5 NotFoundException (org.opencastproject.util.NotFoundException)1