Search in sources :

Example 16 with LocationInfo

use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo 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<>();
    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) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 17 with LocationInfo

use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo in project opennms by OpenNMS.

the class LocationAddedToMapTest method createLocations.

private GWTBounds createLocations(int num, Set<LocationInfo> locations) {
    BoundsBuilder boundsBldr = new BoundsBuilder();
    for (int i = 1; i <= num; i++) {
        double lat = m_random.nextDouble() * 22 + 27;
        double lng = m_random.nextDouble() * -57 - 67;
        boundsBldr.extend(lat, lng);
        LocationInfo location1 = new LocationInfo("location" + i, "area" + i, i + " Opennms Way", lat + "," + lng, 100L, null, new StatusDetails(Status.UP, "reason is that its up"), null);
        locations.add(location1);
    }
    return boundsBldr.getBounds();
}
Also used : BoundsBuilder(org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo)

Example 18 with LocationInfo

use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo in project opennms by OpenNMS.

the class LocationDataManager method pushLocationData.

private void pushLocationData(final EventExecutorService service) {
    LOG.debug("pushing initialized locations");
    List<LocationInfo> locations = getLocationDataService().getInfoForAllLocations();
    for (final LocationInfo locationInfo : locations) {
        final LocationUpdatedRemoteEvent event = new LocationUpdatedRemoteEvent(locationInfo);
        service.addEventUserSpecific(event);
    }
    LOG.debug("finished pushing initialized locations");
}
Also used : LocationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationUpdatedRemoteEvent) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo)

Aggregations

LocationInfo (org.opennms.features.poller.remote.gwt.client.location.LocationInfo)18 Test (org.junit.Test)5 LocationUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.LocationUpdatedRemoteEvent)5 ArrayList (java.util.ArrayList)4 ApplicationUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent)4 HashSet (java.util.HashSet)3 LocationsUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent)3 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 ApplicationInfo (org.opennms.features.poller.remote.gwt.client.ApplicationInfo)2 UpdateCompleteRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.UpdateCompleteRemoteEvent)2 OnmsMonitoringLocation (org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Cell (com.google.gwt.user.client.ui.HTMLTable.Cell)1 Date (java.util.Date)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 GWTLatLng (org.opennms.features.poller.remote.gwt.client.GWTLatLng)1 GWTMarkerState (org.opennms.features.poller.remote.gwt.client.GWTMarkerState)1 StatusDetails (org.opennms.features.poller.remote.gwt.client.StatusDetails)1