Package org.apache.oozie.client.rest

Examples of org.apache.oozie.client.rest.BulkResponseImpl


        q.setFirstResult(start - 1);
        q.setMaxResults(len);

        List<Object[]> response = q.getResultList();
        for (Object[] r : response) {
            BulkResponseImpl br = getResponseFromObject(bundleBean, r);
            responseList.add(br);
        }
        return q.toString();
    }
View Full Code Here


            eachTime.put("endNominal", ts);
        }
    }

    private BulkResponseImpl getResponseFromObject(BundleJobBean bundleBean, Object arr[]) {
        BulkResponseImpl bean = new BulkResponseImpl();
        CoordinatorJobBean coordBean = new CoordinatorJobBean();
        CoordinatorActionBean actionBean = new CoordinatorActionBean();
        if (arr[0] != null) {
            actionBean.setId((String) arr[0]);
        }
        if (arr[1] != null) {
            actionBean.setActionNumber((Integer) arr[1]);
        }
        if (arr[2] != null) {
            actionBean.setErrorCode((String) arr[2]);
        }
        if (arr[3] != null) {
            actionBean.setErrorMessage((String) arr[3]);
        }
        if (arr[4] != null) {
            actionBean.setExternalId((String) arr[4]);
        }
        if (arr[5] != null) {
            actionBean.setExternalStatus((String) arr[5]);
        }
        if (arr[6] != null) {
            actionBean.setStatus(CoordinatorAction.Status.valueOf((String) arr[6]));
        }
        if (arr[7] != null) {
            actionBean.setCreatedTime(DateUtils.toDate((Timestamp) arr[7]));
        }
        if (arr[8] != null) {
            actionBean.setNominalTime(DateUtils.toDate((Timestamp) arr[8]));
        }
        if (arr[9] != null) {
            actionBean.setMissingDependencies((String) arr[9]);
        }
        if (arr[10] != null) {
            coordBean.setId((String) arr[10]);
            actionBean.setJobId((String) arr[10]);
        }
        if (arr[11] != null) {
            coordBean.setAppName((String) arr[11]);
        }
        if (arr[12] != null) {
            coordBean.setStatus(CoordinatorJob.Status.valueOf((String) arr[12]));
        }
        bean.setBundle(bundleBean);
        bean.setCoordinator(coordBean);
        bean.setAction(actionBean);
        return bean;
    }
View Full Code Here

                + "startcreatedtime=2012-07-21T00:00Z;endcreatedtime=2012-07-22T02:00Z";

        List<BulkResponseImpl> brList = _execQuery(request);
        assertEquals(1, brList.size()); // only 1 action satisfies the
                                        // conditions
        BulkResponseImpl br = brList.get(0);
        assertEquals(bundleName, br.getBundle().getAppName());
        assertEquals("Coord1", br.getCoordinator().getAppName());
        assertEquals(CoordinatorAction.Status.FAILED, br.getAction().getStatus());
        assertEquals(DateUtils.parseDateUTC(CREATE_TIME).toString(), br.getAction().getCreatedTime().toString());
    }
View Full Code Here

        // repeatedly execute above query for each bundle
        for (BundleJobBean bundle : bundles) {
            q.setParameter("bundleId", bundle.getId());
            List<Object[]> response = q.getResultList();
            for (Object[] r : response) {
                BulkResponseImpl br = getResponseFromObject(bundle, r);
                responseList.add(br);
            }
        }
        return q.toString();
    }
View Full Code Here

            eachTime.put("endNominal", ts);
        }
    }

    private BulkResponseImpl getResponseFromObject(BundleJobBean bundleBean, Object arr[]) {
        BulkResponseImpl bean = new BulkResponseImpl();
        CoordinatorJobBean coordBean = new CoordinatorJobBean();
        CoordinatorActionBean actionBean = new CoordinatorActionBean();
        if (arr[0] != null) {
            actionBean.setId((String) arr[0]);
        }
        if (arr[1] != null) {
            actionBean.setActionNumber((Integer) arr[1]);
        }
        if (arr[2] != null) {
            actionBean.setErrorCode((String) arr[2]);
        }
        if (arr[3] != null) {
            actionBean.setErrorMessage((String) arr[3]);
        }
        if (arr[4] != null) {
            actionBean.setExternalId((String) arr[4]);
        }
        if (arr[5] != null) {
            actionBean.setExternalStatus((String) arr[5]);
        }
        if (arr[6] != null) {
            actionBean.setStatus(CoordinatorAction.Status.valueOf((String) arr[6]));
        }
        if (arr[7] != null) {
            actionBean.setCreatedTime(DateUtils.toDate((Timestamp) arr[7]));
        }
        if (arr[8] != null) {
            actionBean.setNominalTime(DateUtils.toDate((Timestamp) arr[8]));
        }
        if (arr[9] != null) {
            actionBean.setMissingDependenciesBlob((StringBlob) arr[9]);
        }
        if (arr[10] != null) {
            coordBean.setId((String) arr[10]);
            actionBean.setJobId((String) arr[10]);
        }
        if (arr[11] != null) {
            coordBean.setAppName((String) arr[11]);
        }
        if (arr[12] != null) {
            coordBean.setStatus(CoordinatorJob.Status.valueOf((String) arr[12]));
        }
        bean.setBundle(bundleBean);
        bean.setCoordinator(coordBean);
        bean.setAction(actionBean);
        return bean;
    }
View Full Code Here

        BulkResponseInfo response = _execQuery(request);
        List<BulkResponseImpl> brList = response.getResponses();
        assertEquals(1, brList.size()); // only 1 action satisfies the
                                        // conditions
        assertEquals(1, response.getTotal());
        BulkResponseImpl br = brList.get(0);
        assertEquals(bundleName, br.getBundle().getAppName());
        assertEquals("Coord1", br.getCoordinator().getAppName());
        assertEquals(CoordinatorAction.Status.FAILED, br.getAction().getStatus());
        assertEquals(DateUtils.parseDateUTC(CREATE_TIME).toString(), br.getAction().getCreatedTime().toString());
    }
View Full Code Here

        BulkResponseInfo response = _execQuery(request);
        List<BulkResponseImpl> brList = response.getResponses();
        assertEquals(1, brList.size()); // only 1 action satisfies the
                                        // conditions
        assertEquals(1, response.getTotal());
        BulkResponseImpl br = brList.get(0);
        assertEquals(bundleId, br.getBundle().getId());
        assertEquals("Coord1", br.getCoordinator().getAppName());
        assertEquals(CoordinatorAction.Status.FAILED, br.getAction().getStatus());
        assertEquals(DateUtils.parseDateUTC(CREATE_TIME).toString(), br.getAction().getCreatedTime().toString());
    }
View Full Code Here

            }
            if (answer == 3) {
                JSONObject json = new JSONObject();
                List<BulkResponseImpl> jsonWorkflows = new ArrayList<BulkResponseImpl>();
                BulkResponseImpl bulk = new BulkResponseImpl();
                bulk.setBundle(new BundleJobBean());
                bulk.setCoordinator(new CoordinatorJobBean());
                CoordinatorActionBean action = new CoordinatorActionBean();
                action.setStatus(Status.READY);
                bulk.setAction(action);
                jsonWorkflows.add(bulk);
                jsonWorkflows.add(bulk);
                json.put(JsonTags.BULK_RESPONSES, BulkResponseImpl.toJSONArray(jsonWorkflows, "GMT"));
                result = new ByteArrayInputStream(json.toJSONString().getBytes());
View Full Code Here

            }
            if (answer == 3) {
                JSONObject json = new JSONObject();
                List<BulkResponseImpl> jsonWorkflows = new ArrayList<BulkResponseImpl>();
                BulkResponseImpl bulk = new BulkResponseImpl();
                bulk.setBundle(new BundleJobBean());
                bulk.setCoordinator(new CoordinatorJobBean());
                CoordinatorActionBean action = new CoordinatorActionBean();
                action.setStatus(Status.READY);
                bulk.setAction(action);
                jsonWorkflows.add(bulk);
                jsonWorkflows.add(bulk);
                json.put(JsonTags.BULK_RESPONSES, BulkResponseImpl.toJSONArray(jsonWorkflows, "GMT"));
                result = new ByteArrayInputStream(json.toJSONString().getBytes());
View Full Code Here

        q.setFirstResult(start - 1);
        q.setMaxResults(len);

        List<Object[]> response = q.getResultList();
        for (Object[] r : response) {
            BulkResponseImpl br = getResponseFromObject(bundleBean, r);
            responseList.add(br);
        }
        return q.toString();
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.client.rest.BulkResponseImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.