Examples of toRepresentation()


Examples of org.apache.ace.log.LogDescriptor.toRepresentation()

    @Test(groups = { UNIT })
    public synchronized void getRange() throws Exception {
        final LogDescriptor range = new LogDescriptor("gwID", 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.log.LogDescriptor.toRepresentation()

        final LogEvent event = new LogEvent("gwID", 1, 1, 1, 1, new Properties());
        final List<LogEvent> events = new ArrayList<LogEvent>();
        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.log.LogDescriptor.toRepresentation()

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

Examples of org.apache.ace.log.LogDescriptor.toRepresentation()

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

Examples of org.apache.ace.log.LogEvent.toRepresentation()

     *             in case of any IO error.
     */
    public synchronized LogEvent put(int type, Dictionary props) throws IOException {
        try {
            LogEvent result = new LogEvent(null, m_store.getId(), getNextID(), System.currentTimeMillis(), type, props);
            m_store.append(result.getID(), result.toRepresentation().getBytes());
            return result;
        }
        catch (IOException ex) {
            handleException(m_store, ex);
        }
View Full Code Here

Examples of org.apache.ace.log.LogEvent.toRepresentation()

                    }
                    if (current.getID() == lowest) {
                        // before we send the LogEvent to the other side, we fill out the
                        // appropriate identification
                        LogEvent event = new LogEvent(m_identification.getID(), current);
                        writer.write(event.toRepresentation() + "\n");
                    }
                }
            }
        }
View Full Code Here

Examples of org.apache.ace.log.LogEvent.toRepresentation()

        m_logServlet.handleSend(input);

        String actual = "";
        for (Iterator<LogEvent> i = m_mockStore.m_events.iterator(); i.hasNext();) {
            LogEvent event = i.next();
            actual = actual + event.toRepresentation() + "\n";
        }
        assert expected.equals(actual);
    }

    private class MockLogStore implements LogStore {
View Full Code Here

Examples of org.apache.ace.log.LogEvent.toRepresentation()

            public LogEvent 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.log.LogEvent.toRepresentation()

                    }
                    if (current.getID() == lowest) {
                        // before we send the LogEvent to the other side, we fill out the
                        // appropriate identification
                        LogEvent event = new LogEvent(m_identification.getID(), current);
                        writer.write(event.toRepresentation() + "\n");
                    }
                }
            }
        }
View Full Code Here

Examples of org.apache.ace.log.LogEvent.toRepresentation()

     *             in case of any IO error.
     */
    public synchronized LogEvent put(int type, Dictionary props) throws IOException {
        try {
            LogEvent result = new LogEvent(null, m_store.getId(), getNextID(), System.currentTimeMillis(), type, props);
            m_store.append(result.getID(), result.toRepresentation().getBytes());
            return result;
        }
        catch (IOException ex) {
            handleException(m_store, 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.