AAI-1523 Batch reformat aai-core
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / concurrent / AaiCallableTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *    http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.aai.concurrent;
22
23 import static org.junit.Assert.assertTrue;
24
25 import java.lang.Object;
26
27 import org.junit.Test;
28 import org.onap.aai.AAISetup;
29 import org.onap.aai.concurrent.AaiCallable;
30 import org.slf4j.MDC;
31
32 public class AaiCallableTest extends AAISetup {
33     @Test
34     public void testAaiCallable() {
35         MDC.put("test_name", "test_value");
36
37         AaiCallable<Object> task = new AaiCallable<Object>() {
38             @Override
39             public Object process() {
40                 String mdcValue = MDC.get("test_name");
41                 assertTrue("MDC value retained", "test_value".equals(mdcValue));
42                 return (new Object());
43             }
44         };
45         try {
46             task.call();
47         } catch (Exception e) {
48             e.printStackTrace();
49         }
50     }
51 }