Search in sources :

Example 1 with LocationInfo

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

the class DefaultLocationManager method showLocationDetails.

private void showLocationDetails(final String locationName) {
    // TODO: this needs a callback to get the location details, and fill
    // in the content
    final LocationInfo loc = m_dataManager.getLocation(locationName);
    m_remoteService.getLocationDetails(locationName, new AsyncCallback<LocationDetails>() {

        @Override
        public void onFailure(final Throwable t) {
            String htmlTitle = "Error Getting Location Details";
            String htmlContent = "<p>An error occurred getting the location details.</p>" + "<pre>" + URL.encode(t.getMessage()) + "</pre>";
            m_view.showLocationDetails(locationName, htmlTitle, htmlContent);
        }

        @Override
        public void onSuccess(final LocationDetails locationDetails) {
            m_view.showLocationDetails(locationName, locationName + " (" + loc.getArea() + ")", getLocationInfoDetails(loc, locationDetails));
        }
    });
}
Also used : LocationDetails(org.opennms.features.poller.remote.gwt.client.location.LocationDetails) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo)

Example 2 with LocationInfo

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

the class SerializationTest method testLocationInfo.

@Test
public void testLocationInfo() throws Exception {
    LocationInfo location = getLocationInfo();
    writer.writeObject(location);
}
Also used : LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo) Test(org.junit.Test)

Example 3 with LocationInfo

use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo 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 4 with LocationInfo

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

the class SerializationTest method getLocationInfo.

private LocationInfo getLocationInfo() {
    LocationInfo location = new LocationInfo();
    location.setName("Bob");
    location.setArea("East Coast");
    location.setGeolocation("RDU");
    location.setCoordinates("0.0,0.0");
    location.setStatusDetails(StatusDetails.up());
    location.setMarkerState(getMarker(location));
    return location;
}
Also used : LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo)

Example 5 with LocationInfo

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

the class LocationDataServiceIT method testLocationInfo.

@Test
public void testLocationInfo() throws Exception {
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getAvailable(new Date(now() - days(20) - hours(3))));
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getDown(new Date(now() - days(20) - hours(2))));
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getAvailable(new Date(now() - days(20) - hours(1))));
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getDown(new Date(now() - days(20) - hours(4))));
    LocationInfo li = m_locationDataService.getLocationInfo("RDU");
    assertNotNull(li);
    assertEquals("RDU", li.getName());
    // Down because one of the services is down.
    assertEquals(Status.DOWN, li.getStatusDetails().getStatus());
}
Also used : Date(java.util.Date) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo) Test(org.junit.Test)

Aggregations

LocationInfo (org.opennms.features.poller.remote.gwt.client.location.LocationInfo)17 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 LocationUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.LocationUpdatedRemoteEvent)4 HashSet (java.util.HashSet)3 ApplicationUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent)3 LocationsUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.LocationsUpdatedRemoteEvent)3 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)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 ApplicationInfo (org.opennms.features.poller.remote.gwt.client.ApplicationInfo)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