Package com.sequenceiq.cloudbreak.domain

Examples of com.sequenceiq.cloudbreak.domain.SnsRequest


    @RequestMapping(method = RequestMethod.POST)
    @ResponseBody
    public ResponseEntity<String> receiveSnsMessage(@RequestBody String request) {
        try {
            SnsRequest snsRequest = snsMessageParser.parseRequest(request);
            snsMessageHandler.handleMessage(snsRequest);
            return new ResponseEntity<>(HttpStatus.OK);
        } catch (IOException e) {
            throw new InternalServerException("Failed to parse Amazon SNS message.", e);
        }
View Full Code Here


    @Test
    public void testConfirmSubscriptionWhenTopicIsNotConfirmedShouldNotifyAllRequestedStacks() {
        // GIVEN
        given(awsStackUtil.createSnsClient(Regions.DEFAULT_REGION, credential)).willReturn(snsClient);
        SnsRequest snsRequest = createSnsRequest();
        given(snsTopicRepository.findByTopicArn(AwsConnectorTestUtil.DEFAULT_TOPIC_ARN)).willReturn(Arrays.asList(snsTopic, snsTopic));
        given(snsClient.confirmSubscription(anyString(), anyString())).willReturn(confirmSubscriptionResult);
        given(snsTopicRepository.save(any(SnsTopic.class))).willReturn(snsTopic);
        given(stackRepository.findRequestedStacksWithCredential(AwsConnectorTestUtil.DEFAULT_ID)).willReturn(Arrays.asList(stack, stack));
        // WHEN
View Full Code Here

    }

    @Test
    public void testConfirmSubscriptionWhenTopicIsAlreadyConfirmedShouldNotConfirmTopic() {
        // GIVEN
        SnsRequest snsRequest = createSnsRequest();
        snsTopic.setConfirmed(true);
        given(snsTopicRepository.findByTopicArn(AwsConnectorTestUtil.DEFAULT_TOPIC_ARN)).willReturn(Arrays.asList(snsTopic));
        // WHEN
        underTest.confirmSubscription(snsRequest);
        // THEN
View Full Code Here

    }

    @Test
    public void testConfirmSubscriptionWhenTopicsAreNotFoundShouldNotConfirmTopic() {
        // GIVEN
        SnsRequest snsRequest = createSnsRequest();
        given(snsTopicRepository.findByTopicArn(AwsConnectorTestUtil.DEFAULT_TOPIC_ARN)).willReturn(new ArrayList<SnsTopic>());
        // WHEN
        underTest.confirmSubscription(snsRequest);
        // THEN
        verify(reactor, times(0)).notify(any(ReactorConfig.class), any(Event.class));
View Full Code Here

        // THEN
        verify(reactor, times(0)).notify(any(ReactorConfig.class), any(Event.class));
    }

    private SnsRequest createSnsRequest() {
        SnsRequest snsRequest = new SnsRequest();
        snsRequest.setTopicArn(AwsConnectorTestUtil.DEFAULT_TOPIC_ARN);
        snsRequest.setToken(DUMMY_TOKEN);
        return snsRequest;
    }
View Full Code Here

        // THEN
        verify(reactor, times(0)).notify(any(ReactorConfig.class), any(Event.class));
    }

    private SnsRequest createSnsRequest() {
        SnsRequest req = new SnsRequest();
        req.setMessage("dummyMessage");
        req.setType("dummType");
        req.setSubject(MESSAGE_SUBJECT);
        return req;
    }
View Full Code Here

    private SnsMessageParser underTest = new SnsMessageParser();

    @Test
    public void testSnsRequestParser() throws IOException {
        String request = FileReaderUtils.readFileFromClasspath("sample-sns-request");
        SnsRequest snsRequest = underTest.parseRequest(request);
        Assert.assertEquals("AWS CloudFormation Notification", snsRequest.getSubject());
        Assert.assertEquals("2014-06-17T09:41:29.564Z", snsRequest.getTimestamp());
    }
View Full Code Here

    }

    @Test
    public void testSnsCFMessageParser() throws IOException {
        String request = FileReaderUtils.readFileFromClasspath("sample-sns-request");
        SnsRequest snsRequest = underTest.parseRequest(request);

        Map<String, String> result = underTest.parseCFMessage(snsRequest.getMessage());

        Assert.assertEquals("sns-test-200", result.get("StackName"));
        Assert.assertEquals("DELETE_COMPLETE", result.get("ResourceStatus"));

    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.domain.SnsRequest

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.