Package org.apache.ace.feedback

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


            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

            }

            // 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

                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

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

        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

        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

                    }
                    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

        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

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.