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