Package org.apache.ace.feedback

Examples of org.apache.ace.feedback.Descriptor


            return;
        }

        storeEvents();

        List<Event> events = m_logStore.get(new Descriptor("mytarget1,1,0"));
        assertEquals(3, events.size());
    }
View Full Code Here


            return;
        }

        storeEvents();

        List<Event> events = m_logStore.get(new Descriptor("mytarget1,1,2"));
        assertEquals(2, events.size());
    }
View Full Code Here

        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String targetID = request.getParameter("tid");
            long logID = Long.parseLong(request.getParameter("logid"));
            response.getOutputStream().print(new Descriptor(targetID, logID, new SortedRangeSet(new long[0])).toRepresentation());
            response.setStatus(200);
        }
View Full Code Here

            // get and evaluate results (note that there is some concurrency that might interfere with this test)
            List<Descriptor> ranges2 = m_serverStore.getDescriptors();
            if (ranges2.size() > 0) {
              assertEquals("We should still have audit log events for one target on the server, but found " + ranges2.size(), 1, ranges2.size());
                Descriptor range = ranges2.get(0);
                List<Event> events = m_serverStore.get(range);
                if (events.size() > 1) {
                  assertTrue("We should have a couple of events, at least more than the one we added ourselves.", events.size() > 1);
                    for (Event event : events) {
                        if (event.getType() == 12345) {
View Full Code Here

        TestUtils.configureObject(m_task, LogStore.class);
    }

    @Test(groups = { UNIT })
    public synchronized void getRange() throws Exception {
        final Descriptor range = new Descriptor(TARGET_ID, 1, new SortedRangeSet("1-10"));
        m_task.getDescriptor(new InputStream() {
            int m_count = 0;
            byte[] m_bytes = (range.toRepresentation() + "\n").getBytes();
            @Override
            public int read() throws IOException {
                if (m_count < m_bytes.length) {
                    byte b = m_bytes[m_count];
                    m_count++;
View Full Code Here

        });
    }

    @Test(groups = { UNIT })
    public synchronized void synchronizeLog() throws Exception {
        final Descriptor range = new Descriptor(TARGET_ID, 1, new SortedRangeSet(new long[] {0}));
        final Event event = new Event(TARGET_ID, 1, 1, 1, 1);
        final List<Event> events = new ArrayList<Event>();
        events.add(event);

        InputStream input = new InputStream() {
            byte[] bytes = range.toRepresentation().getBytes();
            int count = 0;
            @Override
            public int read() throws IOException {
                if (count < bytes.length) {
                    byte b = bytes[count];
View Full Code Here

    List<Descriptor> diffLogDescriptorLists(List<Descriptor> all, List<Descriptor> seen) {
        List<Descriptor> descriptors = new ArrayList<Descriptor>();

        // Find out what events should be returned
        for (Descriptor s : all) {
            Descriptor diffs = s;
            for (Descriptor d : seen) {
                if ((s.getStoreID() == d.getStoreID()) && (s.getTargetID().equals(d.getTargetID()))) {
                    diffs = new Descriptor(s.getTargetID(), s.getStoreID(), d.getRangeSet().diffDest(s.getRangeSet()));
                }
            }
            descriptors.add(diffs);
        }
        return descriptors;
View Full Code Here

            String rangeString = queryReader.readLine();
            if (rangeString == null) {
                throw new IOException("Could not construct LogDescriptor from stream because stream is empty");
            }
            try {
                return new Descriptor(rangeString);
            }
            catch (IllegalArgumentException e) {
                throw new IOException("Could not determine highest remote event id, received malformed event range (" + rangeString + ")");
            }
        }
View Full Code Here

public class LogDescriptorTest {

    @Test(groups = { UNIT })
    public void serializeDescriptor() {
        Descriptor descriptor = new Descriptor("gwid", 1, new SortedRangeSet("2-3"));
        assert descriptor.toRepresentation().equals("gwid,1,2-3") : "The representation of our descriptor is incorrect:" + descriptor.toRepresentation();
    }
View Full Code Here

        assert descriptor.toRepresentation().equals("gwid,1,2-3") : "The representation of our descriptor is incorrect:" + descriptor.toRepresentation();
    }

    @Test(groups = { UNIT })
    public void deserializeDescriptor() {
        Descriptor descriptor = new Descriptor("gwid,1,2-3");
        assert descriptor.getTargetID().equals("gwid") : "Target ID not correctly parsed.";
        assert descriptor.getStoreID() == 1 : "Log ID not correctly parsed.";
        assert descriptor.getRangeSet().toRepresentation().equals("2-3") : "There should be nothing in the diff between the set in the descriptor and the check-set.";
    }
View Full Code Here

TOP

Related Classes of org.apache.ace.feedback.Descriptor

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.