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=========================================================
25 import org.junit.BeforeClass;
26 import org.junit.ClassRule;
27 import org.junit.Rule;
28 import org.onap.aai.config.*;
29 import org.onap.aai.edges.EdgeIngestor;
30 import org.onap.aai.introspection.LoaderFactory;
31 import org.onap.aai.introspection.MoxyLoader;
32 import org.onap.aai.nodes.NodeIngestor;
33 import org.onap.aai.rest.db.HttpEntry;
34 import org.onap.aai.serialization.db.EdgeSerializer;
35 import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
36 import org.onap.aai.setup.SchemaVersion;
37 import org.onap.aai.setup.SchemaVersions;
38 import org.onap.aai.testutils.TestUtilConfigTranslatorforDataLink;
39 import org.onap.aai.util.AAIConstants;
40 import org.springframework.beans.factory.annotation.Autowired;
41 import org.springframework.beans.factory.annotation.Value;
42 import org.springframework.test.annotation.DirtiesContext;
43 import org.springframework.test.context.ContextConfiguration;
44 import org.springframework.test.context.TestPropertySource;
45 import org.springframework.test.context.junit4.rules.SpringClassRule;
46 import org.springframework.test.context.junit4.rules.SpringMethodRule;
48 @ContextConfiguration(
49 classes = {ConfigConfiguration.class, TestUtilConfigTranslatorforDataLink.class, EdgeIngestor.class,
50 EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class, IntrospectionConfig.class,
51 RestBeanConfig.class, XmlFormatTransformerConfiguration.class})
53 properties = {"schema.uri.base.path = /aai", "schema.xsd.maxoccurs = 5000", "schema.version.api.default = v4",
54 "schema.version.edge.label.start = v4", "schema.version.depth.start = v3",
55 "schema.version.app.root.start = v4", "schema.version.related.link.start = v4",
56 "schema.version.namespace.change.start = v4", "schema.version.list = v1,v2,v3,v4",
57 "schema.translator.list = config"})
58 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
59 public abstract class DataLinkSetup {
62 public static final SpringClassRule springClassRule = new SpringClassRule();
65 public final SpringMethodRule springMethodRule = new SpringMethodRule();
68 protected Map<SchemaVersion, MoxyLoader> moxyLoaderInstance;
71 protected HttpEntry traversalHttpEntry;
74 protected HttpEntry traversalUriHttpEntry;
77 protected NodeIngestor nodeIngestor;
80 protected LoaderFactory loaderFactory;
83 protected SchemaVersions schemaVersions;
85 @Value("${schema.uri.base.path}")
86 protected String basePath;
88 @Value("${schema.xsd.maxoccurs}")
89 protected String maxOccurs;
91 protected static final String SERVICE_NAME = "JUNIT";
94 public static void setupBundleconfig() throws Exception {
95 System.setProperty("AJSC_HOME", ".");
96 System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
97 System.setProperty("aai.service.name", SERVICE_NAME);
98 QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"),
99 "src/test/resources/bundleconfig-local/etc/oxm/");