AAI-1523 Batch reformat aai-schema-ingest
[aai/aai-common.git] / aai-schema-ingest / src / test / java / org / onap / aai / setup / SchemaVersionsBeanOverrideTest.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  * <p>
11  * http://www.apache.org/licenses/LICENSE-2.0
12  * <p>
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.setup;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25
26 import java.io.IOException;
27 import java.util.List;
28
29 import org.junit.Rule;
30 import org.junit.Test;
31 import org.junit.rules.ExpectedException;
32 import org.junit.runner.RunWith;
33 import org.onap.aai.restclient.MockProvider;
34 import org.springframework.beans.factory.annotation.Autowired;
35 import org.springframework.boot.test.context.SpringBootTest;
36 import org.springframework.test.context.ContextConfiguration;
37 import org.springframework.test.context.TestPropertySource;
38 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
39
40 @RunWith(SpringJUnit4ClassRunner.class)
41 @TestPropertySource(
42         properties = {
43                 "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties"})
44 @ContextConfiguration(classes = {MockProvider.class, SchemaVersionsBean.class, SchemaConfigVersions.class})
45 @SpringBootTest
46 public class SchemaVersionsBeanOverrideTest {
47
48     // set thrown.expect to whatever a specific test needs
49     // this establishes a default of expecting no exceptions to be thrown
50     @Rule
51     public ExpectedException thrown = ExpectedException.none();
52     @Autowired
53     SchemaVersionsBean SchemaVersionsBean;
54
55     @Test
56     public void testGetContextForVersion() throws IOException {
57
58         SchemaVersions versions = SchemaVersionsBean.getSchemaVersions();
59         assertEquals(versions.getDefaultVersion(), new SchemaVersion("v15"));
60     }
61
62     @Test
63     public void testGetVersions() throws IOException {
64
65         List<SchemaVersion> versions = SchemaVersionsBean.getVersions();
66         assertNotNull(versions);
67     }
68
69     @Test
70     public void testGetters() throws IOException {
71         List<SchemaVersion> versionsList = SchemaVersionsBean.getVersions();
72         assertNotNull(versionsList);
73         SchemaVersions versions = SchemaVersionsBean.getSchemaVersions();
74
75         assertEquals(versions.getAppRootVersion(), new SchemaVersion("v11"));
76         assertEquals(versions.getDepthVersion(), new SchemaVersion("v10"));
77         assertEquals(versions.getEdgeLabelVersion(), new SchemaVersion("v12"));
78         assertEquals(versions.getNamespaceChangeVersion(), new SchemaVersion("v11"));
79         assertEquals(versions.getRelatedLinkVersion(), new SchemaVersion("v10"));
80
81     }
82
83 }