Package org.rhq.core.domain.event

Examples of org.rhq.core.domain.event.Event


            Vector<Hashtable> notifList = null;
            notifList = (Vector<Hashtable>) alertAttribute.refresh();
          for (Hashtable notifHash : notifList) {
              long timestamp = (new Long ((String) notifHash.get(NOTIFICATION_TIMESTAMP_LONG))).longValue();
               
              Event event = new Event(getEventType(),
                ((String)notifHash.get(NOTIFICATION_TYPE)),
                timestamp,
                EventSeverity.WARN,
                ((String)notifHash.get(NOTIFICATION_MESSAGE)));
              EmsOperation clear = emsbean.getOperation(CLEAR_ALERT_OPERATION);
View Full Code Here


            Vector<Hashtable> notifList = null;
            notifList = (Vector<Hashtable>) alertAttribute.refresh();
          for (Hashtable notifHash : notifList) {
              long timestamp = (new Long ((String) notifHash.get(NOTIFICATION_TIMESTAMP_LONG))).longValue();
               
              Event event = new Event(getEventType(),
                ((String)notifHash.get(NOTIFICATION_TYPE)),
                timestamp,
                EventSeverity.WARN,
                ((String)notifHash.get(NOTIFICATION_MESSAGE)));
              EmsOperation clear = emsbean.getOperation(CLEAR_ALERT_OPERATION);
View Full Code Here

        Log4JLogEntryProcessor processor = new Log4JLogEntryProcessor(eventType, logFile);
        BufferedReader bufferedReader = new BufferedReader(new StringReader(TEST_LOG.toString()));
        Set<Event> events = processor.processLines(bufferedReader);
        assert events != null && events.size() == 2;
        Iterator<Event> eventIterator = events.iterator();
        Event event1 = eventIterator.next();
        assert eventType.equals(event1.getType());
        assert new File(event1.getSourceLocation()).equals(logFile);
        Calendar calendar = Calendar.getInstance();
        calendar.set(2007, 11, 9, 15, 32, 49);
        calendar.set(Calendar.MILLISECOND, 909);
        long expectedTimestamp = calendar.getTimeInMillis();
        assert event1.getTimestamp() == expectedTimestamp;
        assert event1.getSeverity().equals(EventSeverity.DEBUG);
        assert event1.getDetail().equals("[com.example.FooBar] run: IdleRemover notifying pools, interval: 450000");
        Event event2 = eventIterator.next();
        assert event2.getDetail().startsWith("[com.example.FooBar] a multi-line entry\n");
        assert event2.getDetail().endsWith("\twocka wocka");
        System.out.println("SUCCESS!");
        System.out.println("Testing with matching includes pattern...");
        processor.setIncludesPattern(Pattern.compile("wocka wocka"));
        bufferedReader = new BufferedReader(new StringReader(TEST_LOG.toString()));
        events = processor.processLines(bufferedReader);
View Full Code Here

        String logEntry = "2007-12-09 15:32:49,909 [DEBUG] [com.example.FooBar] test message";
        BufferedReader bufferedReader = new BufferedReader(new StringReader(logEntry));
        Set<Event> events = processor.processLines(bufferedReader);
        assert events != null && events.size() == 1;
        Iterator<Event> eventIterator = events.iterator();
        Event event1 = eventIterator.next();
        assert eventType.equals(event1.getType());
        assert new File(event1.getSourceLocation()).equals(logFile);
        Calendar calendar = Calendar.getInstance();
        calendar.set(2007, 11, 9, 15, 32, 49);
        calendar.set(Calendar.MILLISECOND, 909);
        long expectedTimestamp = calendar.getTimeInMillis();
        assert event1.getTimestamp() == expectedTimestamp;
        assert event1.getSeverity().equals(EventSeverity.DEBUG);
        assert event1.getDetail().equals("[com.example.FooBar] test message");
    }
View Full Code Here

        String logEntry = "2007-12-09 15:32:49,909 (DEBUG) [com.example.FooBar] test message";
        BufferedReader bufferedReader = new BufferedReader(new StringReader(logEntry));
        Set<Event> events = processor.processLines(bufferedReader);
        assert events != null && events.size() == 1;
        Iterator<Event> eventIterator = events.iterator();
        Event event1 = eventIterator.next();
        assert eventType.equals(event1.getType());
        assert new File(event1.getSourceLocation()).equals(logFile);
        Calendar calendar = Calendar.getInstance();
        calendar.set(2007, 11, 9, 15, 32, 49);
        calendar.set(Calendar.MILLISECOND, 909);
        long expectedTimestamp = calendar.getTimeInMillis();
        assert event1.getTimestamp() == expectedTimestamp;
        assert event1.getSeverity().equals(EventSeverity.DEBUG);
        assert event1.getDetail().equals("[com.example.FooBar] test message");
    }
View Full Code Here

        String logEntry = "2007-12-09 15:32:49,909 [ DEBUG ) [com.example.FooBar] test message";
        BufferedReader bufferedReader = new BufferedReader(new StringReader(logEntry));
        Set<Event> events = processor.processLines(bufferedReader);
        assert events != null && events.size() == 1;
        Iterator<Event> eventIterator = events.iterator();
        Event event1 = eventIterator.next();
        assert eventType.equals(event1.getType());
        assert new File(event1.getSourceLocation()).equals(logFile);
        Calendar calendar = Calendar.getInstance();
        calendar.set(2007, 11, 9, 15, 32, 49);
        calendar.set(Calendar.MILLISECOND, 909);
        long expectedTimestamp = calendar.getTimeInMillis();
        assert event1.getTimestamp() == expectedTimestamp;
        assert event1.getSeverity().equals(EventSeverity.DEBUG);
        assert event1.getDetail().equals("[com.example.FooBar] test message");
    }
View Full Code Here

            Map<EventSource, Set<Event>> events = new HashMap<EventSource, Set<Event>>();
            for (int sourceNum = 0; sourceNum < NUM_SOURCES; sourceNum++) {
                Set<Event> eventSet = new HashSet<Event>();
                for (int i = 0; i < LINES_PER_REPORT; i++) {
                    Event ev = new Event("EType", "ESource" + sourceNum, now + round * i, EventSeverity.INFO,
                        "This is a 2nd test", evSrc[sourceNum]);
                    eventSet.add(ev);
                }
                events.put(evSrc[sourceNum], eventSet);
            }
View Full Code Here

                    found = true;
                    // We got the definition that will vanish later, so attach some stuff to it
                    EventSource source = new EventSource("test location", def, testResource);
                    em.persist(source);

                    Event ev = new Event(def.getName(), source.getLocation(), System.currentTimeMillis(),
                        EventSeverity.INFO, "This is a test");
                    Set<Event> evSet = new HashSet<Event>(1);
                    evSet.add(ev);
                    events.put(source, evSet);
                }
View Full Code Here

        EventSource source = findEventSourceById(sourceId);
        Map<EventSource,Set<Event>> eventMap = new HashMap<EventSource, Set<Event>>();
        Set<Event> events = new LinkedHashSet<Event>(eventRest.size());
        for (EventRest eRest : eventRest) {
            EventSeverity eventSeverity = EventSeverity.valueOf(eRest.getSeverity());
            Event event = new Event(eRest.getTimestamp(),eventSeverity,source,eRest.getDetail());
            events.add(event);
        }
        eventMap.put(source,events);
        eventManager.addEventData(eventMap);
View Full Code Here

    public boolean addLimitWarningEvents() {
        if (this.addedLimitWarningEvents || this.eventsDropped == null) {
            return false; // we already added them or there is nothing to add
        }

        Event warningEvent;
        String warningMessage;
        long now = System.currentTimeMillis();

        for (Map.Entry<EventSource, Integer> entry : this.eventsDropped.entrySet()) {
            EventSource eventSource = entry.getKey();
            Integer droppedCount = entry.getValue();
            Set<Event> eventSet = getEventsForEventSource(eventSource);

            if (eventSet.size() >= this.maxEventsPerSource) {
                // this event source hit its individual limit
                warningMessage = "Event Report Limit Reached: reached the maximum allowed events ["
                    + this.maxEventsPerSource + "] for this event source - dropped [" + droppedCount + "] events";
            } else {
                // this report reached its total limit, even though this event source did not hit its individual limit
                warningMessage = "Event Report Limit Reached: reached total maximum allowed events ["
                    + this.maxEventsPerReport + "] - dropped [" + droppedCount + "] events";
            }

            warningEvent = new Event(eventSource.getEventDefinition().getName(), eventSource.getLocation(), now,
                EventSeverity.WARN, warningMessage, eventSource);
            eventSet.add(warningEvent);

            this.addedLimitWarningEvents = true;
        }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.event.Event

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.