Examples of toRepresentation()


Examples of org.apache.ace.feedback.Descriptor.toRepresentation()

    @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

Examples of org.apache.ace.feedback.Descriptor.toRepresentation()

        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

Examples of org.apache.ace.feedback.Descriptor.toRepresentation()

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();
    }

    @Test(groups = { UNIT })
    public void deserializeDescriptor() {
        Descriptor descriptor = new Descriptor("gwid,1,2-3");
View Full Code Here

Examples of org.apache.ace.feedback.Descriptor.toRepresentation()

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();
    }

    @Test(groups = { UNIT })
    public void deserializeDescriptor() {
        Descriptor descriptor = new Descriptor("gwid,1,2-3");
View Full Code Here

Examples of org.apache.ace.feedback.Descriptor.toRepresentation()

    public void deserializeMultiRangeDescriptorWithFunnyGWID() {
        String line = "gw$$id,1,1-4$k6$k8$k10-20";
        Descriptor descriptor = new Descriptor(line);
        assert descriptor.getTargetID().equals("gw$id") : "Target ID not correctly parsed.";
        assert descriptor.getStoreID() == 1 : "Log ID not correctly parsed.";
        assert line.equals(descriptor.toRepresentation()) : "Converting the line back to the representation failed.";
        String representation = descriptor.getRangeSet().toRepresentation();
        assert representation.equals("1-4,6,8,10-20") : "There should be nothing in the diff between the set in the descriptor and the check-set, but we parsed: " + representation;
    }

    @Test(groups = { UNIT }, expectedExceptions = IllegalArgumentException.class)
View Full Code Here

Examples of org.apache.ace.feedback.Descriptor.toRepresentation()

    // Handle a call to the query 'command'
    protected boolean handleQuery(String targetID, String logID, String filter, ServletOutputStream output) throws IOException {
        if ((targetID != null) && (logID != null)) {
            // target and log id are specified, return only the range that matches these id's
            Descriptor range = m_store.getDescriptor(targetID, Long.parseLong(logID));
            output.print(range.toRepresentation());
            return true;
        }
        else if ((targetID == null) && (logID == null)) {
            // no target or log id has been specified, return all ranges
            List<Descriptor> ranges = m_store.getDescriptors();
View Full Code Here

Examples of org.apache.ace.feedback.Descriptor.toRepresentation()

        }
        else if ((targetID == null) && (logID == null)) {
            // no target or log id has been specified, return all ranges
            List<Descriptor> ranges = m_store.getDescriptors();
            for (Descriptor range : ranges) {
                output.print(range.toRepresentation() + "\n");
            }
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.apache.ace.feedback.Event.toRepresentation()

            public Event put(int type, Dictionary props) throws IOException { return null; }
        });
        MockConnection connection = new MockConnection(new URL("http://mock"));
       
        m_task.synchronizeLog(1, input, connection);
        String expectedString = event.toRepresentation() + "\n";
        String actualString = connection.getString();

        assert actualString.equals(expectedString) : "We expected " + expectedString + " but received " + actualString;
    }
View Full Code Here

Examples of org.apache.ace.feedback.Event.toRepresentation()

            while ((current.getID() > lowest) && rangeIterator.hasNext()) {
                lowest = rangeIterator.next();
            }
            if (current.getID() == lowest) {
                Event event = new Event(identification, current);
                sendWriter.write(event.toRepresentation());
                sendWriter.write("\n");
            }
        }
    }
}
View Full Code Here

Examples of org.apache.ace.feedback.Event.toRepresentation()

            }

            // log the event XXX shouldn't the target ID be filled in?
            Event result = new Event(getTargetID(), storeID, nextEventId, System.currentTimeMillis(), type, properties);

            currentStore.append(result.getID(), result.toRepresentation().getBytes());
        }
        catch (IOException ex) {
            handleException(currentStore, ex);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.