Standalone TCA with EELF Logger
[dcaegen2/analytics/tca-gen2.git] / dcae-analytics / dcae-analytics-web / src / test / java / org / onap / dcae / analytics / web / config / DmaapMrTestConfig.java
1 /*
2  * ================================================================================
3  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ============LICENSE_END=========================================================
17  *
18  */
19
20 package org.onap.dcae.analytics.web.config;
21
22 import org.onap.dcae.analytics.model.AnalyticsProfile;
23 import org.onap.dcae.analytics.web.BaseAnalyticsWebSpringBootIT;
24 import org.onap.dcae.analytics.web.dmaap.MrPublisherPreferences;
25 import org.onap.dcae.analytics.web.dmaap.MrSubscriberPreferences;
26 import org.springframework.context.annotation.Bean;
27 import org.springframework.context.annotation.Configuration;
28 import org.springframework.context.annotation.Profile;
29 import org.springframework.integration.channel.DirectChannel;
30 import org.springframework.integration.channel.QueueChannel;
31 import org.springframework.integration.dsl.IntegrationFlow;
32 import org.springframework.integration.dsl.IntegrationFlows;
33 import org.springframework.integration.handler.LoggingHandler;
34
35 /**
36  * @author Rajiv Singla
37  */
38 @Configuration
39 @Profile({AnalyticsProfile.DMAAP_PROFILE_NAME})
40 public class DmaapMrTestConfig {
41
42     @Bean
43     public MrSubscriberPreferences mrSubscriberPreferences() {
44         return new MrSubscriberPreferences(BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_TOPIC_URL, null,
45                 null, BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_AAF_USERNAME,
46                 BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_AAF_PASSWORD,
47                 null, null, null,
48                 BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_CONSUMER_GROUP,
49                 BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_CONSUMER_IDS,
50                 null, null, null);
51     }
52
53     @Bean
54     public MrPublisherPreferences mrPublisherPreferences() {
55         return new MrPublisherPreferences(BaseAnalyticsWebSpringBootIT.TEST_PUBLISHER_TOPIC_URL);
56     }
57
58     @Bean
59     public Integer processingBatchSize() {
60         return 1;
61     }
62
63
64     @Bean
65     public IntegrationFlow noOperationMrFlow(final QueueChannel mrSubscriberOutputChannel,
66                                              final DirectChannel mrPublisherInputChannel) {
67         return IntegrationFlows.from(mrSubscriberOutputChannel)
68                 .log(LoggingHandler.Level.INFO)
69                 .channel(mrPublisherInputChannel)
70                 .get();
71     }
72
73 }