Search in sources :

Example 1 with LocationsUpdatedRemoteEvent

use of org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent in project opennms by OpenNMS.

the class SerializationTest method testEvents.

@Test
public void testEvents() throws Exception {
    final ApplicationUpdatedRemoteEvent aure = new ApplicationUpdatedRemoteEvent(getApplicationInfo());
    writer.writeObject(aure);
    final GeocodingUpdatingRemoteEvent gure = new GeocodingUpdatingRemoteEvent(0, 15);
    writer.writeObject(gure);
    final GeocodingFinishedRemoteEvent gfre = new GeocodingFinishedRemoteEvent(15);
    writer.writeObject(gfre);
    final LocationUpdatedRemoteEvent lure = new LocationUpdatedRemoteEvent(getLocationInfo());
    writer.writeObject(lure);
    Collection<LocationInfo> locations = new ArrayList<LocationInfo>();
    locations.add(getLocationInfo());
    final LocationsUpdatedRemoteEvent lsure = new LocationsUpdatedRemoteEvent(locations);
    writer.writeObject(lsure);
    final UpdateCompleteRemoteEvent ucre = new UpdateCompleteRemoteEvent();
    writer.writeObject(ucre);
}
Also used : UpdateCompleteRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.UpdateCompleteRemoteEvent) ArrayList(java.util.ArrayList) LocationsUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent) GeocodingUpdatingRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.GeocodingUpdatingRemoteEvent) LocationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationUpdatedRemoteEvent) ApplicationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent) GeocodingFinishedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.GeocodingFinishedRemoteEvent) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo) Test(org.junit.Test)

Example 2 with LocationsUpdatedRemoteEvent

use of org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent in project opennms by OpenNMS.

the class LocationAddedToMapTest method testAddLocation.

@Test
public void testAddLocation() {
    int numLocations = 3000;
    int numApps = 12;
    Set<LocationInfo> locations = new HashSet<LocationInfo>();
    GWTBounds bounds = createLocations(numLocations, locations);
    for (LocationInfo locationInfo : locations) {
        m_testServer.sendUserSpecificEvent(new LocationUpdatedRemoteEvent(locationInfo));
    }
    //create apps and update by sending event
    Set<ApplicationInfo> apps = createApps(numApps, locations);
    for (ApplicationInfo app : apps) {
        m_testServer.sendUserSpecificEvent(new ApplicationUpdatedRemoteEvent(app));
    }
    m_testServer.sendUserSpecificEvent(new UpdateCompleteRemoteEvent());
    m_testExecutor.run();
    assertNotNull(m_testApplicationView.getMapBounds());
    assertEquals(bounds, m_testApplicationView.getMapBounds());
    assertEquals(numLocations, m_testApplicationView.getMarkerCount());
    m_testApplicationView.resetMarkerCount();
    m_testServer.sendDomainEvent(new LocationsUpdatedRemoteEvent(locations));
    for (ApplicationInfo app : apps) {
        m_testServer.sendDomainEvent(new ApplicationUpdatedRemoteEvent(app));
    }
    m_testExecutor.run();
    assertEquals(0, m_testApplicationView.getMarkerCount());
}
Also used : UpdateCompleteRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.UpdateCompleteRemoteEvent) LocationsUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent) LocationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationUpdatedRemoteEvent) ApplicationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent) HashSet(java.util.HashSet) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo) Test(org.junit.Test)

Example 3 with LocationsUpdatedRemoteEvent

use of org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent in project opennms by OpenNMS.

the class LocationAddedToMapTest method testStatusMessage.

@Test
public void testStatusMessage() {
    int numLocations = 10;
    Set<LocationInfo> locations = new HashSet<LocationInfo>();
    createLocations(numLocations, locations);
    m_testServer.sendDomainEvent(new LocationsUpdatedRemoteEvent(locations));
    int updated = 0;
    while (!m_testExecutor.runOnePass()) {
        updated++;
        assertEquals("Updated " + updated + " of 10", m_testApplicationView.getStatusMessage());
    }
}
Also used : LocationsUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent) HashSet(java.util.HashSet) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo) Test(org.junit.Test)

Example 4 with LocationsUpdatedRemoteEvent

use of org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent in project opennms by OpenNMS.

the class LocationDataManager method doUpdate.

void doUpdate(final Date startDate, final Date endDate, final EventExecutorService service) {
    LOG.debug("pushing monitor status updates");
    service.addEvent(MapRemoteEventHandler.LOCATION_EVENT_DOMAIN, new LocationsUpdatedRemoteEvent(getLocationDataService().getUpdatedLocationsBetween(startDate, endDate)));
    LOG.debug("finished pushing monitor status updates");
    // Every 5 minutes, update the application list too
    LOG.debug("pushing application updates");
    final Collection<ApplicationHandler> appHandlers = new ArrayList<ApplicationHandler>();
    final DefaultApplicationHandler applicationHandler = new DefaultApplicationHandler(getLocationDataService(), service, getActiveApplications());
    appHandlers.add(applicationHandler);
    getLocationDataService().handleAllApplications(appHandlers);
    setActiveApplications(applicationHandler.getApplicationNames());
    LOG.debug("finished pushing application updates");
}
Also used : LocationsUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent) ArrayList(java.util.ArrayList)

Aggregations

LocationsUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent)4 Test (org.junit.Test)3 LocationInfo (org.opennms.features.poller.remote.gwt.client.location.LocationInfo)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ApplicationUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent)2 LocationUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.LocationUpdatedRemoteEvent)2 UpdateCompleteRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.UpdateCompleteRemoteEvent)2 GeocodingFinishedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.GeocodingFinishedRemoteEvent)1 GeocodingUpdatingRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.GeocodingUpdatingRemoteEvent)1