View Javadoc
1   /*
2    * Copyright 2017 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.openehealth.ipf.boot.atna;
18  
19  import org.junit.Test;
20  import org.junit.runner.RunWith;
21  import org.openehealth.ipf.commons.audit.AuditContext;
22  import org.openehealth.ipf.commons.audit.queue.AsynchronousAuditMessageQueue;
23  import org.springframework.beans.factory.annotation.Autowired;
24  import org.springframework.boot.test.context.SpringBootTest;
25  import org.springframework.test.context.junit4.SpringRunner;
26  
27  import static org.junit.Assert.assertEquals;
28  import static org.junit.Assert.assertTrue;
29  
30  /**
31   *
32   */
33  @RunWith(SpringRunner.class)
34  @SpringBootTest(classes = { TestApplication.class })
35  public class IpfAtnaAutoConfigurationTest {
36  
37      @Autowired
38      private AuditContext auditContext;
39  
40  
41      @Autowired
42      private IpfAtnaConfigurationProperties ipfAtnaConfigurationProperties;
43  
44  
45      @Test
46      public void testAtnaSettings() throws Exception {
47          assertEquals("atna-test", auditContext.getAuditSourceId());
48          assertEquals("mysite", auditContext.getAuditEnterpriseSiteId());
49          assertEquals("localhost", auditContext.getAuditRepositoryHostName());
50          assertEquals(1234, auditContext.getAuditRepositoryPort());
51          assertEquals("TLS", auditContext.getAuditTransmissionProtocol().getTransportName());
52          assertTrue(auditContext.getAuditMessageQueue() instanceof AsynchronousAuditMessageQueue);
53      }
54  
55  }