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());
}
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();
}
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");
}
Aggregations