Package org.rhq.core.domain.event

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


    private void addEventForCurrentEntry(Set<Event> events, LogEntry currentEntry) {
        if (currentEntry != null) {
            if (currentEntry.getSeverity().isAtLeastAsSevereAs(this.minimumSeverity)
                && (this.includesPattern == null || this.includesPattern.matcher(currentEntry.getDetail()).find())) {
                Event event = new Event(this.eventType, this.logFile.getPath(), currentEntry.getDate().getTime(),
                    currentEntry.getSeverity(), currentEntry.getDetail());
                events.add(event);
            }
        }
    }
View Full Code Here


        try {
            Resource resource = source.getResource();
            List<EventCacheElement> cacheElements = lookupEventCacheElements(resource.getId());

            for (Iterator<Event> i = events.iterator(); i.hasNext();) {
                Event event = i.next();
                i.remove();
                int matched = stats.matched;
                processCacheElements(cacheElements, event.getSeverity(), event.getTimestamp(), stats,
                    "sourceLocation=" + source.getLocation(), event.getDetail());
                if (matched < stats.matched) {
                    break;
                }
            }
View Full Code Here


        EventContext eventContext = resourceContext.getEventContext();

        for (int i = 0; i < count; ++i) {
            Event event = new Event(eventType, source, System.currentTimeMillis(), severity, details);
            eventContext.publishEvent(event);
        }

        result = new OperationResult("failed");
        return result;
View Full Code Here

        int count = Integer.parseInt(System.getProperty(SYSPROP_EVENTS_COUNT, "1"));
        String severityString = System.getProperty(SYSPROP_EVENTS_SEVERITY, EventSeverity.INFO.name());
        EventSeverity severity = EventSeverity.valueOf(severityString);
        Set<Event> events = new HashSet<Event>(count);
        for (int i = 0; i < count; i++) {
            Event event = new Event(PERFTEST_EVENT_TYPE, "source.loc", System.currentTimeMillis(), severity, "event #"
                + i);
            events.add(event);
        }
        return events;
    }
View Full Code Here

    public String getChannel() {
        return channel;
    }

    public void acceptMessage(String sender, String login, String hostname, String message) {
        Event event = new Event("message", sender, System.currentTimeMillis(), EventSeverity.INFO, message);
        this.eventContext.publishEvent(event);

        this.messageCount.incrementAndGet();
    }
View Full Code Here

                    else
                        severity = EventSeverity.INFO;
                }
            }

            Event event = new Event(getEventType(), sourceAddr, System.currentTimeMillis(), severity, payload
                .toString());
            if (log.isDebugEnabled())
                log.debug("queue event " + event);

            synchronized (events) {
View Full Code Here

        ResourceType resourceType = new ResourceType("foo", "foo", ResourceCategory.PLATFORM, null);
        Resource resource = new Resource(1);
        EventDefinition eventDefinition = new EventDefinition(resourceType, "foo");
        EventSource eventSource = new EventSource("foo", eventDefinition, resource);
        EventReport report = new EventReport(10, 10);
        report.addEvent(new Event("foo", "foo", 0, EventSeverity.DEBUG, "foo-first", eventSource), eventSource);
        report.addLimitWarningEvents(); // should do nothing
        Map<EventSource, Set<Event>> allEvents = report.getEvents();
        assert allEvents.size() == 1;
        assert allEvents.get(eventSource).size() == 1;

        report.addEvent(new Event("foo", "foo", 1, EventSeverity.DEBUG, "foo-second", eventSource), eventSource);
        report.addLimitWarningEvents(); // should do nothing
        allEvents = report.getEvents();
        assert allEvents.size() == 1; // only one event source still!
        assert allEvents.get(eventSource).size() == 2;

        // make sure they are the ones we expect
        for (Event e : allEvents.get(eventSource)) {
            assert e.getDetail().startsWith("foo-");
        }

        // use a second event source
        EventSource eventSource2 = new EventSource("bar", eventDefinition, resource);
        report.addEvent(new Event("bar", "bar", 2, EventSeverity.DEBUG, "bar-first", eventSource2), eventSource2);
        report.addLimitWarningEvents(); // should do nothing
        allEvents = report.getEvents();
        assert allEvents.size() == 2;
        assert allEvents.get(eventSource).size() == 2;
        assert allEvents.get(eventSource2).size() == 1;
View Full Code Here

        assert allEvents.get(eventSource2).size() == 1; // this isn't the "real" bar event, its the limit warn event
        assert allEvents.get(eventSource2).iterator().next().getDetail().contains("Event Report Limit Reached:");
    }

    private void addEvent(EventReport report, String testId, String testDetail, EventSource eventSource) {
        report.addEvent(new Event(testId, testId, System.currentTimeMillis(), EventSeverity.DEBUG, testId + "-"
            + testDetail, eventSource), eventSource);
        return;
    }
View Full Code Here

        ResourceType resourceType = new ResourceType("foo", "foo", ResourceCategory.PLATFORM, null);
        Resource resource = new Resource(1);
        EventDefinition eventDefinition = new EventDefinition(resourceType, "foo");
        EventSource eventSource = new EventSource("foo", eventDefinition, resource);
        EventReport report = new EventReport(2, 2);
        report.addEvent(new Event("foo", "foo", 0, EventSeverity.DEBUG, ""), eventSource);
        assert ensureSerializable(report).getEvents().size() == 1;
        report.addEvent(new Event("foo", "foo", 1, EventSeverity.DEBUG, ""), eventSource);
        assert ensureSerializable(report).getEvents().size() == 1; // only one event source still!
        assert ensureSerializable(report).getEvents().values().iterator().next().size() == 2;
    }
View Full Code Here

        EventDefinition ed = res.getResourceType().getEventDefinitions().iterator().next();
        EventSource source = new EventSource("datapurgejobtest", ed, res);
        Map<EventSource, Set<Event>> eventMap = new HashMap<EventSource, Set<Event>>();
        Set<Event> events = new HashSet<Event>();
        for (int i = 0; i < count; i++) {
            events.add(new Event(ed.getName(), source.getLocation(), timestamp + i, EventSeverity.DEBUG, "details"));
        }
        eventMap.put(source, events);

        EventManagerLocal mgr = LookupUtil.getEventManager();
        mgr.addEventData(eventMap);
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.