use of org.opencastproject.workflow.api.WorkflowSet in project opencast by opencast.
the class WorkflowServiceImplTest method testNegativeWorkflowQuery.
@Test
public void testNegativeWorkflowQuery() throws Exception {
// Ensure that the database doesn't have any workflow instances
Assert.assertEquals(0, service.countWorkflowInstances());
Assert.assertEquals(0, service.getWorkflowInstances(new WorkflowQuery().withText("Climate").withCount(100).withStartPage(0)).size());
startAndWait(workingDefinition, mediapackage1, WorkflowState.SUCCEEDED);
startAndWait(workingDefinition, mediapackage2, WorkflowState.SUCCEEDED);
startAndWait(failingDefinitionWithoutErrorHandler, mediapackage1, WorkflowState.FAILED);
WorkflowSet succeededWorkflows = service.getWorkflowInstances(new WorkflowQuery().withState(WorkflowState.SUCCEEDED));
Assert.assertEquals(2, succeededWorkflows.getItems().length);
WorkflowSet failedWorkflows = service.getWorkflowInstances(new WorkflowQuery().withState(WorkflowState.FAILED));
Assert.assertEquals(1, failedWorkflows.getItems().length);
// Ensure that the "without" queries works
WorkflowSet notFailedWorkflows = service.getWorkflowInstances(new WorkflowQuery().withoutState(WorkflowState.FAILED));
Assert.assertEquals(2, notFailedWorkflows.getItems().length);
}
use of org.opencastproject.workflow.api.WorkflowSet in project opencast by opencast.
the class WorkflowServiceImplTest method testGetWorkflowByWildcardMatching.
@Test
public void testGetWorkflowByWildcardMatching() throws Exception {
String searchTerm = "another";
String searchTermWithoutQuotes = "yet another";
String searchTermInQuotes = "\"" + searchTermWithoutQuotes + "\"";
String title = "just" + searchTerm + " " + searchTermInQuotes + " rev129";
// Ensure that the database doesn't have any workflow instances
Assert.assertEquals(0, service.countWorkflowInstances());
mediapackage1.setTitle(title);
startAndWait(workingDefinition, mediapackage1, WorkflowState.SUCCEEDED);
WorkflowSet workflowsWithTitle = service.getWorkflowInstances(new WorkflowQuery().withTitle(searchTerm));
Assert.assertEquals(1, workflowsWithTitle.getTotalCount());
WorkflowSet workflowsWithQuotedTitle = service.getWorkflowInstances(new WorkflowQuery().withTitle(searchTermInQuotes));
Assert.assertEquals(1, workflowsWithQuotedTitle.getTotalCount());
WorkflowSet workflowsWithUnQuotedTitle = service.getWorkflowInstances(new WorkflowQuery().withTitle(searchTermWithoutQuotes));
Assert.assertEquals(1, workflowsWithUnQuotedTitle.getTotalCount());
}
use of org.opencastproject.workflow.api.WorkflowSet in project opencast by opencast.
the class WorkflowServiceImplTest method testGetWorkflowSort.
@Test
public void testGetWorkflowSort() throws Exception {
String contributor1 = "foo";
String contributor2 = "bar";
String contributor3 = "baz";
// Ensure that the database doesn't have any workflow instances
Assert.assertEquals(0, service.countWorkflowInstances());
// set contributors (a multivalued field)
mediapackage1.addContributor(contributor1);
mediapackage1.addContributor(contributor2);
mediapackage2.addContributor(contributor2);
mediapackage2.addContributor(contributor3);
// run the workflows
startAndWait(workingDefinition, mediapackage1, WorkflowState.SUCCEEDED);
startAndWait(workingDefinition, mediapackage2, WorkflowState.SUCCEEDED);
WorkflowSet workflowsWithContributor1 = service.getWorkflowInstances(new WorkflowQuery().withContributor(contributor1));
WorkflowSet workflowsWithContributor2 = service.getWorkflowInstances(new WorkflowQuery().withContributor(contributor2));
WorkflowSet workflowsWithContributor3 = service.getWorkflowInstances(new WorkflowQuery().withContributor(contributor3));
Assert.assertEquals(1, workflowsWithContributor1.getTotalCount());
Assert.assertEquals(2, workflowsWithContributor2.getTotalCount());
Assert.assertEquals(1, workflowsWithContributor3.getTotalCount());
}
use of org.opencastproject.workflow.api.WorkflowSet in project opencast by opencast.
the class WorkflowServiceImplTest method testGetWorkflowByEpisodeId.
@Test
public void testGetWorkflowByEpisodeId() throws Exception {
String mediaPackageId = mediapackage1.getIdentifier().toString();
// Ensure that the database doesn't have a workflow instance with this episode
Assert.assertEquals(0, service.countWorkflowInstances());
Assert.assertEquals(0, service.getWorkflowInstances(new WorkflowQuery().withMediaPackage(mediaPackageId)).size());
startAndWait(workingDefinition, mediapackage1, WorkflowState.SUCCEEDED);
WorkflowSet workflowsInDb = service.getWorkflowInstances(new WorkflowQuery().withMediaPackage(mediaPackageId));
Assert.assertEquals(1, workflowsInDb.getItems().length);
}
use of org.opencastproject.workflow.api.WorkflowSet in project opencast by opencast.
the class WorkflowServiceImplTest method testGetWorkflowByText.
@Test
public void testGetWorkflowByText() throws Exception {
// Ensure that the database doesn't have any workflow instances
Assert.assertEquals(0, service.countWorkflowInstances());
Assert.assertEquals(0, service.getWorkflowInstances(new WorkflowQuery().withText("Climate").withCount(100).withStartPage(0)).size());
startAndWait(workingDefinition, mediapackage1, WorkflowState.SUCCEEDED);
WorkflowSet workflowsInDb = service.getWorkflowInstances(new WorkflowQuery().withText("Climate").withCount(100).withStartPage(0));
Assert.assertEquals(1, workflowsInDb.getItems().length);
Assert.assertEquals(1, service.getWorkflowInstances(new WorkflowQuery().withText("limate")).size());
Assert.assertEquals(1, service.getWorkflowInstances(new WorkflowQuery().withText("mate")).size());
Assert.assertEquals(1, service.getWorkflowInstances(new WorkflowQuery().withText("lima")).size());
}
Aggregations