Examples of toRepresentation()


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

                String key = (String) keys.nextElement();
                props.put(key, (String) dict.get(key));
            }
           
            Event result = new Event(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.feedback.Event.toRepresentation()

public class LogEventTest {
    @Test(groups = { UNIT })
    public void serializeLogEvent() {
        Event e = new Event("gwid", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED);
        assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
        Map<String, String> p = new HashMap<String, String>();
        p.put(AuditEvent.KEY_ID, "my first value");
        e = new Event("gwid", 1, 2, 3, AuditEvent.BUNDLE_INSTALLED, p);
        assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.BUNDLE_INSTALLED + "," + AuditEvent.KEY_ID + ",my first value");
        e = new Event("gwid,gwid\n\r$", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED);
View Full Code Here

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

        Event e = new Event("gwid", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED);
        assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
        Map<String, String> p = new HashMap<String, String>();
        p.put(AuditEvent.KEY_ID, "my first value");
        e = new Event("gwid", 1, 2, 3, AuditEvent.BUNDLE_INSTALLED, p);
        assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.BUNDLE_INSTALLED + "," + AuditEvent.KEY_ID + ",my first value");
        e = new Event("gwid,gwid\n\r$", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED);
        assert e.toRepresentation().equals("gwid$kgwid$n$r$$,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
    }

    @Test(groups = { UNIT })
View Full Code Here

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

        Map<String, String> p = new HashMap<String, String>();
        p.put(AuditEvent.KEY_ID, "my first value");
        e = new Event("gwid", 1, 2, 3, AuditEvent.BUNDLE_INSTALLED, p);
        assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.BUNDLE_INSTALLED + "," + AuditEvent.KEY_ID + ",my first value");
        e = new Event("gwid,gwid\n\r$", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED);
        assert e.toRepresentation().equals("gwid$kgwid$n$r$$,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
    }

    @Test(groups = { UNIT })
    public void deserializeLogEvent() {
        Event e = new Event("gwid$kgwid$n$r$$,1,2,3," + AuditEvent.FRAMEWORK_STARTED + ",a,1,b,2,c,3");
View Full Code Here

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

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

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

        m_logServlet.handleSend(input);

        String actual = "";
        for (Iterator<Event> i = m_mockStore.m_events.iterator(); i.hasNext();) {
            Event 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.LogDescriptor.toRepresentation()

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

        final LogEvent event = new LogEvent(TARGET_ID, 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 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
            LogDescriptor 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<LogDescriptor> ranges = m_store.getDescriptors();
View Full Code Here

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

        }
        else if ((targetID == null) && (logID == null)) {
            // no target 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
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.