AAI-1523 Batch reformat aai-schema-ingest
[aai/aai-common.git] / aai-schema-ingest / src / test / java / org / onap / aai / setup / SchemaVersionsBeanTest.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 = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties"})
43 @ContextConfiguration(classes = {MockProvider.class, SchemaVersionsBean.class})
44 @SpringBootTest
45 public class SchemaVersionsBeanTest {
46
47     // set thrown.expect to whatever a specific test needs
48     // this establishes a default of expecting no exceptions to be thrown
49     @Rule
50     public ExpectedException thrown = ExpectedException.none();
51     @Autowired
52     SchemaVersionsBean SchemaVersionsBean;
53
54     @Test
55     public void testGetContextForVersion() throws IOException {
56
57         SchemaVersions versions = SchemaVersionsBean.getSchemaVersions();
58         assertEquals(versions.getDefaultVersion(), new SchemaVersion("v15"));
59     }
60
61     @Test
62     public void testGetVersions() throws IOException {
63
64         List<SchemaVersion> versions = SchemaVersionsBean.getVersions();
65         assertNotNull(versions);
66     }
67
68     @Test
69     public void testGetters() throws IOException {
70
71         List<SchemaVersion> versionsList = SchemaVersionsBean.getVersions();
72         assertNotNull(versionsList);
73         SchemaVersions versions = SchemaVersionsBean.getSchemaVersions();
74         /*
75          * //assertEquals(versions.getAppRootVersion(), new SchemaVersion("v15"));
76          * assertEquals(versions.getAppRootVersion(), new SchemaVersion("v11"));
77          * assertEquals(versions.getDepthVersion(), new SchemaVersion("v10"));
78          * assertEquals(versions.getEdgeLabelVersion(), new SchemaVersion("v12"));
79          * assertEquals(versions.getNamespaceChangeVersion(), new SchemaVersion("v11"));
80          * assertEquals(versions.getRelatedLinkVersion(), new SchemaVersion("v10"));
81          */
82
83         assertEquals(versions.getAppRootVersion(), new SchemaVersion("v15"));
84         assertEquals(versions.getDepthVersion(), new SchemaVersion("v15"));
85         assertEquals(versions.getEdgeLabelVersion(), new SchemaVersion("v15"));
86         assertEquals(versions.getNamespaceChangeVersion(), new SchemaVersion("v15"));
87         assertEquals(versions.getRelatedLinkVersion(), new SchemaVersion("v15"));
88
89     }
90
91 }