Package org.onebusaway.transit_data_federation.services.service_alerts.ServiceAlerts

Examples of org.onebusaway.transit_data_federation.services.service_alerts.ServiceAlerts.ServiceAlertsCollection


    ServiceAlert.Builder builder = ServiceAlert.newBuilder();
    ServiceAlert serviceAlert = _service.createOrUpdateServiceAlert(builder,
        "1");

    FileInputStream in = new FileInputStream(_serviceAlertsPath);
    ServiceAlertsCollection collection = ServiceAlertsCollection.parseFrom(in);
    in.close();

    assertEquals(1, collection.getServiceAlertsCount());
    ServiceAlert read = collection.getServiceAlerts(0);
    assertEquals(serviceAlert.getId().getAgencyId(), read.getId().getAgencyId());
    assertEquals(serviceAlert.getId().getId(), read.getId().getId());
    assertEquals(serviceAlert.getCreationTime(), read.getCreationTime());
  }
View Full Code Here


    InputStream in = null;

    try {

      in = new BufferedInputStream(new FileInputStream(path));
      ServiceAlertsCollection collection = ServiceAlertsCollection.parseFrom(in);
      for (ServiceAlert serviceAlert : collection.getServiceAlertsList())
        updateReferences(serviceAlert);

    } catch (Exception ex) {
      _log.error("error loading service alerts from path " + path, ex);
    } finally {
View Full Code Here

    if (path == null)
      return;

    ServiceAlertsCollection.Builder builder = ServiceAlertsCollection.newBuilder();
    builder.addAllServiceAlerts(_serviceAlerts.values());
    ServiceAlertsCollection collection = builder.build();

    OutputStream out = null;
    try {
      out = new BufferedOutputStream(new FileOutputStream(path));
      collection.writeTo(out);
      out.close();
    } catch (Exception ex) {
      _log.error("error saving service alerts to path " + path, ex);
    } finally {
      if (out != null) {
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.service_alerts.ServiceAlerts.ServiceAlertsCollection

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.