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=========================================================
24 import org.junit.BeforeClass;
26 import org.junit.ClassRule;
27 import org.junit.Rule;
28 import org.onap.aai.config.SpringContextAware;
29 import org.onap.aai.edges.EdgeIngestor;
30 import org.onap.aai.config.IntrospectionConfig;
31 import org.onap.aai.introspection.LoaderFactory;
32 import org.onap.aai.introspection.MoxyLoader;
33 import org.onap.aai.nodes.NodeIngestor;
34 import org.onap.aai.config.RestBeanConfig;
35 import org.onap.aai.rest.db.HttpEntry;
36 import org.onap.aai.setup.AAIConfigTranslator;
37 import org.onap.aai.serialization.db.EdgeSerializer;
38 import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
39 import org.onap.aai.setup.SchemaLocationsBean;
40 import org.onap.aai.setup.SchemaVersion;
41 import org.onap.aai.setup.SchemaVersions;
42 import org.onap.aai.util.AAIConstants;
43 import org.springframework.beans.factory.annotation.Autowired;
44 import org.springframework.beans.factory.annotation.Value;
45 import org.springframework.test.context.ContextConfiguration;
46 import org.springframework.test.context.TestPropertySource;
47 import org.springframework.test.context.junit4.rules.SpringClassRule;
48 import org.springframework.test.context.junit4.rules.SpringMethodRule;
51 @ContextConfiguration(classes = {
52 SchemaLocationsBean.class,
54 AAIConfigTranslator.class,
58 SpringContextAware.class,
59 IntrospectionConfig.class,
62 @TestPropertySource(properties = { "schema.uri.base.path = /aai" })
63 public abstract class AAISetup {
66 public static final SpringClassRule springClassRule = new SpringClassRule();
69 public final SpringMethodRule springMethodRule = new SpringMethodRule();
72 protected Map<SchemaVersion, MoxyLoader> moxyLoaderInstance;
75 protected HttpEntry traversalHttpEntry;
78 protected HttpEntry traversalUriHttpEntry;
81 protected NodeIngestor nodeIngestor;
84 protected LoaderFactory loaderFactory;
87 protected SchemaVersions schemaVersions;
89 @Value("${schema.uri.base.path}")
90 protected String basePath;
92 protected static final String SERVICE_NAME = "JUNIT";
95 public static void setupBundleconfig() throws Exception {
96 System.setProperty("AJSC_HOME", ".");
97 System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
98 System.setProperty("aai.service.name", SERVICE_NAME);
99 QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/bundleconfig-local/etc/oxm/");