コード例 #1
0
  @Test
  public void shouldNotSendAnyEventThroughGatewayIfDestinationIsDisabled() throws Exception {
    destinationUri =
        new RESTDestinationURIDealer() {}.toRestDestinationURI(
            tenant.getDomainName(), REGISTERED_AND_INACTIVE_DESTINATION_GUID);

    subject.send(event, destinationUri, null, tenant);

    verify(httpGateway, never()).request(any(), any(), any(), any(), any(), any());
    verify(eventRepository, never()).saveIncoming(tenant, event);
  }
コード例 #2
0
  @Test
  public void shouldRaiseAnExceptionIfDestinationIsUnknown() throws Exception {
    destinationUri =
        new RESTDestinationURIDealer() {}.toRestDestinationURI(
            tenant.getDomainName(), "unknown_guid");

    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage(MessageFormat.format("REST Destination is unknown : {0}", destinationUri));

    subject.send(event, destinationUri, null, tenant);
  }
コード例 #3
0
  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    EventPublisherRest.class.cast(subject).setEventRepository(eventRepository);

    tenant = tenantRepository.findByDomainName("konker");
    destination =
        destinationService.getByGUID(tenant, REGISTERED_AND_ACTIVE_DESTINATION_GUID).getResult();

    destinationUri =
        new RESTDestinationURIDealer() {}.toRestDestinationURI(
            tenant.getDomainName(), destination.getGuid());

    event =
        Event.builder()
            //                .channel(DEVICE_MQTT_CHANNEL)
            .payload(validEventPayload)
            .timestamp(Instant.now())
            .build();
  }