Package com.seyren.core.domain

Examples of com.seyren.core.domain.Subscription


        this.notificationServices = notificationServices;
    }
   
    @Override
    public Response createSubscription(String checkId, Subscription subscription) {
        Subscription stored = subscriptionsStore.createSubscription(checkId, subscription);
        return Response.created(uri(checkId, stored.getId())).build();
    }
View Full Code Here


      });
      if (subscriptions.size() != 1) {
        return Response.status(Response.Status.NOT_FOUND).build();
      }
      check.setState(AlertType.ERROR);
      Subscription subscription = subscriptions.iterator().next();
      List<Alert> interestingAlerts = new ArrayList<Alert>();
      Alert alert = new Alert()
          .withTarget(check.getTarget())
          .withValue(BigDecimal.valueOf(0.0))
          .withWarn(check.getWarn())
          .withError(check.getError())
          .withFromType(AlertType.OK)
          .withToType(AlertType.ERROR)
          .withTimestamp(new DateTime());
      interestingAlerts.add(alert);
      for (NotificationService notificationService : notificationServices) {
        if (notificationService.canHandle(subscription.getType())) {
          try {
            notificationService.sendNotification(check, subscription, interestingAlerts);
          } catch (Exception e) {
            LOGGER.warn("Notifying {} by {} failed.", subscription.getTarget(), subscription.getType(), e);
            return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                .entity(String.format("Notifying failed '%s'", e.getMessage())).type(MediaType.TEXT_PLAIN).build();
          }
        }
      }
View Full Code Here

        boolean ignoreOk = getOptionalBoolean(dbo, "ignoreOk", false);
        LocalTime fromTime = getLocalTime(dbo, "fromHour", "fromMin");
        LocalTime toTime = getLocalTime(dbo, "toHour", "toMin");
        boolean enabled = getBoolean(dbo, "enabled");
       
        return new Subscription()
                .withId(id)
                .withTarget(target)
                .withType(type)
                .withSu(su)
                .withMo(mo)
View Full Code Here

        }
       
        Check check = new Check().withEnabled(true).withName("check-name")
                .withState(AlertType.ERROR);
       
        Subscription subscription = new Subscription().withType(
                SubscriptionType.IRCCAT).withTarget("#mychannel");
       
        Alert alert = new Alert().withTarget("the.target.name")
                .withValue(BigDecimal.valueOf(12))
                .withWarn(BigDecimal.valueOf(5))
View Full Code Here

        Check check = new Check()
                .withEnabled(true)
                .withName("check-name")
                .withState(AlertType.ERROR);
       
        Subscription subscription = new Subscription()
                .withType(SubscriptionType.HUBOT)
                .withTarget("123,456");
       
        Alert alert = new Alert()
                .withTarget("the.target.name")
View Full Code Here

        Check check = new Check()
                .withId("123")
                .withEnabled(true)
                .withName("test-check")
                .withState(AlertType.ERROR);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.PAGERDUTY)
                .withTarget("servicekey123");
        Alert alert = new Alert()
                .withId("890")
View Full Code Here

        Check check = new Check()
                .withId("123")
                .withEnabled(true)
                .withName("test-check")
                .withState(AlertType.OK);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.PAGERDUTY)
                .withTarget("servicekey123");
        List<Alert> alerts = new ArrayList<Alert>();
View Full Code Here

    public void basicHappyPathTest() throws Exception {
        Check check = new Check()
                .withEnabled(true)
                .withName("test-check")
                .withState(AlertType.ERROR);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.HIPCHAT)
                .withTarget("target");
        Alert alert = new Alert()
                .withFromType(AlertType.OK)
View Full Code Here

                .withName("test-check")
                .withDescription("Some great description")
                .withWarn(new BigDecimal("2.0"))
                .withError(new BigDecimal("3.0"))
                .withState(AlertType.ERROR);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.EMAIL)
                .withTarget("some@email.com");
        Alert alert = new Alert()
                .withTarget("some.value")
View Full Code Here

                .withName("test-check")
                .withDescription("")
                .withWarn(new BigDecimal("2.0"))
                .withError(new BigDecimal("3.0"))
                .withState(AlertType.ERROR);
        Subscription subscription = new Subscription()
                .withEnabled(true)
                .withType(SubscriptionType.EMAIL)
                .withTarget("some@email.com");
        Alert alert = new Alert()
                .withTarget("some.value")
View Full Code Here

TOP

Related Classes of com.seyren.core.domain.Subscription

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.