Package org.apache.oozie

Examples of org.apache.oozie.BulkResponseInfo


            String conditions = actionQuery(em, bundleBean, actionTimes, responseList);

            // Query to get the count of records
            long total = countQuery(conditions, em, bundleBean, actionTimes);

            BulkResponseInfo bulk = new BulkResponseInfo(responseList, start, len, total);
            return bulk;
        }
        catch (Exception e) {
            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
        }
View Full Code Here


            int len = (lenStr != null) ? Integer.parseInt(lenStr) : 50;
            len = (len < 1) ? 50 : len;

            BundleEngine bundleEngine = Services.get().get(BundleEngineService.class).getBundleEngine(getUser(request),
                    getAuthToken(request));
            BulkResponseInfo bulkResponse = bundleEngine.getBulkJobs(bulkFilter, start, len);
            List<BulkResponseImpl> jsonResponse = bulkResponse.getResponses();

            json.put(JsonTags.BULK_RESPONSES, BulkResponseImpl.toJSONArray(jsonResponse, timeZoneId));
            json.put(JsonTags.BULK_RESPONSE_TOTAL, bulkResponse.getTotal());
            json.put(JsonTags.BULK_RESPONSE_OFFSET, bulkResponse.getStart());
            json.put(JsonTags.BULK_RESPONSE_LEN, bulkResponse.getLen());

        }
        catch (BaseEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
View Full Code Here

        }
    }

    private List<BulkResponseImpl> _execQuery(String request) throws JPAExecutorException, BundleEngineException {
        BulkJPAExecutor bulkjpa = new BulkJPAExecutor(BundleEngine.parseBulkFilter(request), 1, 10);
        BulkResponseInfo response = jpaService.execute(bulkjpa);
        assertNotNull(response);
        return response.getResponses();
    }
View Full Code Here

            int len = (lenStr != null) ? Integer.parseInt(lenStr) : 50;
            len = (len < 1) ? 50 : len;

            BundleEngine bundleEngine = Services.get().get(BundleEngineService.class).getBundleEngine(getUser(request),
                    getAuthToken(request));
            BulkResponseInfo bulkResponse = bundleEngine.getBulkJobs(bulkFilter, start, len);
            List<BulkResponseImpl> jsonResponse = bulkResponse.getResponses();

            json.put(JsonTags.BULK_RESPONSES, BulkResponseImpl.toJSONArray(jsonResponse, timeZoneId));
            json.put(JsonTags.BULK_RESPONSE_TOTAL, bulkResponse.getTotal());
            json.put(JsonTags.BULK_RESPONSE_OFFSET, bulkResponse.getStart());
            json.put(JsonTags.BULK_RESPONSE_LEN, bulkResponse.getLen());

        }
        catch (BaseEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
View Full Code Here

            String conditions = actionQuery(em, bundleBeans, actionTimes, responseList);

            // Query to get the count of records
            long total = countQuery(conditions, em, bundleBeans, actionTimes);

            BulkResponseInfo bulk = new BulkResponseInfo(responseList, start, len, total);
            return bulk;
        }
        catch (Exception e) {
            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
        }
View Full Code Here

        String request = "bundle=" + bundleName + ";actionstatus=FAILED;"
                + "startcreatedtime=2012-07-21T00:00Z;endcreatedtime=2012-07-22T02:00Z;"
                + "startscheduledtime=2012-07-20T23:00Z;endscheduledtime=2012-07-22T03:00Z";

        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

        String request = "bundle=" + bundleName + ";actionstatus=FAILED,KILLED;"
                + "startcreatedtime=2012-07-21T00:00Z;endcreatedtime=2012-07-22T02:00Z;"
                + "startscheduledtime=2012-07-20T23:00Z;endscheduledtime=2012-07-22T03:00Z";

        BulkResponseInfo response = _execQuery(request);
        List<BulkResponseImpl> brList = response.getResponses();
        assertEquals(3, brList.size()); // 3 actions satisfy the conditions
        assertEquals(3,  response.getTotal());
        List<String> possibleStatus = new ArrayList<String>(Arrays.asList("KILLED", "FAILED"));
        List<String> resultStatus = new ArrayList<String>();
        resultStatus.add(brList.get(0).getAction().getStatus().toString());
        resultStatus.add(brList.get(1).getAction().getStatus().toString());
        assertEquals(possibleStatus, resultStatus);
View Full Code Here

    }

    public void testMultipleCoordinators() throws Exception {
        // there are 3 coordinators but giving range as only two of them
        String request = "bundle=" + bundleName + ";coordinators=Coord1,Coord2;actionstatus=KILLED";
        BulkResponseInfo response = _execQuery(request);
        List<BulkResponseImpl> brList = response.getResponses();
        assertEquals(2, brList.size()); // 2 actions satisfy the conditions
        assertEquals(2, response.getTotal());
        assertEquals(brList.get(0).getAction().getId(), "Coord1@2");
        assertEquals(brList.get(1).getAction().getId(), "Coord2@1");
    }
View Full Code Here

    public void testDefaultStatus() throws Exception {
        // adding coordinator action #4 to Coord#3
        addRecordToCoordActionTable("Coord3", 1, CoordinatorAction.Status.FAILED, "coord-action-get.xml", 0);

        String request = "bundle=" + bundleName + ";";
        BulkResponseInfo response = _execQuery(request);
        List<BulkResponseImpl> brList = response.getResponses();
        assertEquals(4, brList.size()); // 4 actions satisfy the conditions
        assertEquals(4, response.getTotal());
        List<String> possibleStatus = new ArrayList<String>(Arrays.asList("FAILED", "KILLED"));
        List<String> resultStatus = new ArrayList<String>();
        resultStatus.add(brList.get(0).getAction().getStatus().toString());
        resultStatus.add(brList.get(1).getAction().getStatus().toString());
        assertEquals(possibleStatus, resultStatus);
View Full Code Here

    public void testBundleId() throws Exception {
        String request = "bundle=" + bundleId + ";actionstatus=FAILED;"
                + "startcreatedtime=2012-07-21T00:00Z;endcreatedtime=2012-07-22T02:00Z";

        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

TOP

Related Classes of org.apache.oozie.BulkResponseInfo

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.