Search in sources :

Example 11 with WorkflowsInfo

use of org.apache.oozie.WorkflowsInfo in project oozie by apache.

the class TestDBWorkflowStore method _testGetWFInfos.

private void _testGetWFInfos() throws StoreException {
    Map<String, List<String>> filter = new HashMap<String, List<String>>();
    store.beginTrx();
    WorkflowsInfo wfInfo = store.getWorkflowsInfo(filter, 1, 1);
    System.out.println("got WorkflowsInfo " + wfInfo.getLen());
    List<WorkflowJobBean> wfBeans = wfInfo.getWorkflows();
    store.commitTrx();
    assertEquals(1, wfBeans.size());
    filter = new HashMap<String, List<String>>();
    wfInfo = store.getWorkflowsInfo(filter, 1, 2);
    wfBeans = wfInfo.getWorkflows();
    assertEquals(2, wfBeans.size());
    filter = new HashMap<String, List<String>>();
    filter.put("user", Arrays.asList(getTestUser()));
    wfInfo = store.getWorkflowsInfo(filter, 1, 2);
    wfBeans = wfInfo.getWorkflows();
    assertEquals(1, wfBeans.size());
    filter = new HashMap<String, List<String>>();
    filter.put("user", Arrays.asList(getTestUser(), getTestUser2()));
    wfInfo = store.getWorkflowsInfo(filter, 1, 2);
    wfBeans = wfInfo.getWorkflows();
    assertEquals(2, wfBeans.size());
    filter = new HashMap<String, List<String>>();
    filter.put("user", Arrays.asList(getTestUser()));
    filter.put("status", Arrays.asList("succeeded"));
    wfInfo = store.getWorkflowsInfo(filter, 1, 2);
    wfBeans = wfInfo.getWorkflows();
    assertEquals(1, wfBeans.size());
    filter = new HashMap<String, List<String>>();
    filter.put("user", Arrays.asList(getTestUser(), getTestUser2()));
    filter.put("name", Arrays.asList("testApp"));
    wfInfo = store.getWorkflowsInfo(filter, 1, 2);
    wfBeans = wfInfo.getWorkflows();
    assertEquals(2, wfBeans.size());
    assertEquals(2, wfInfo.getTotal());
    assertEquals(1, wfInfo.getStart());
    assertEquals(2, wfInfo.getLen());
    filter = new HashMap<String, List<String>>();
    filter.put("user", Arrays.asList(getTestUser(), getTestUser2()));
    filter.put("name", Arrays.asList("testApp"));
    wfInfo = store.getWorkflowsInfo(filter, 1, 1);
    wfBeans = wfInfo.getWorkflows();
    assertEquals(1, wfBeans.size());
    assertEquals(2, wfInfo.getTotal());
    assertEquals(1, wfInfo.getStart());
    assertEquals(1, wfInfo.getLen());
}
Also used : WorkflowsInfo(org.apache.oozie.WorkflowsInfo) HashMap(java.util.HashMap) List(java.util.List) WorkflowJobBean(org.apache.oozie.WorkflowJobBean)

Aggregations

WorkflowsInfo (org.apache.oozie.WorkflowsInfo)11 ArrayList (java.util.ArrayList)8 List (java.util.List)8 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)8 HashMap (java.util.HashMap)7 JPAService (org.apache.oozie.service.JPAService)6 DagEngine (org.apache.oozie.DagEngine)3 DagEngineException (org.apache.oozie.DagEngineException)3 DagEngineService (org.apache.oozie.service.DagEngineService)3 JSONObject (org.json.simple.JSONObject)3 Date (java.util.Date)2 XException (org.apache.oozie.XException)2 Timestamp (java.sql.Timestamp)1 Map (java.util.Map)1 Query (javax.persistence.Query)1 BundleEngine (org.apache.oozie.BundleEngine)1 BundleEngineException (org.apache.oozie.BundleEngineException)1 BundleJobInfo (org.apache.oozie.BundleJobInfo)1 CoordinatorEngine (org.apache.oozie.CoordinatorEngine)1 CoordinatorEngineException (org.apache.oozie.CoordinatorEngineException)1