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=========================================================
23 import org.junit.BeforeClass;
24 import org.junit.ClassRule;
25 import org.junit.Rule;
26 import org.onap.aai.config.*;
27 import org.onap.aai.edges.EdgeIngestor;
28 import org.onap.aai.introspection.LoaderFactory;
29 import org.onap.aai.introspection.MoxyLoader;
30 import org.onap.aai.nodes.NodeIngestor;
31 import org.onap.aai.rest.db.HttpEntry;
32 import org.onap.aai.serialization.db.EdgeSerializer;
33 import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
34 import org.onap.aai.setup.AAIConfigTranslator;
35 import org.onap.aai.setup.SchemaVersion;
36 import org.onap.aai.setup.SchemaVersions;
37 import org.onap.aai.util.AAIConstants;
38 import org.springframework.beans.factory.annotation.Autowired;
39 import org.springframework.beans.factory.annotation.Value;
40 import org.springframework.test.context.ContextConfiguration;
41 import org.springframework.test.context.TestPropertySource;
42 import org.springframework.test.context.junit4.rules.SpringClassRule;
43 import org.springframework.test.context.junit4.rules.SpringMethodRule;
47 @ContextConfiguration(
49 ConfigConfiguration.class,
50 AAIConfigTranslator.class,
54 SpringContextAware.class,
55 IntrospectionConfig.class,
57 XmlFormatTransformerConfiguration.class
62 "schema.uri.base.path = /aai",
63 "schema.xsd.maxoccurs = 5000",
64 "schema.translator.list=config",
65 "schema.nodes.location=src/test/resources/onap/oxm",
66 "schema.edges.location=src/test/resources/onap/dbedgerules"
69 public abstract class AAISetup {
72 public static final SpringClassRule springClassRule = new SpringClassRule();
75 public final SpringMethodRule springMethodRule = new SpringMethodRule();
78 protected Map<SchemaVersion, MoxyLoader> moxyLoaderInstance;
81 protected HttpEntry traversalHttpEntry;
84 protected HttpEntry traversalUriHttpEntry;
87 protected NodeIngestor nodeIngestor;
90 protected LoaderFactory loaderFactory;
93 protected SchemaVersions schemaVersions;
95 @Value("${schema.uri.base.path}")
96 protected String basePath;
98 @Value("${schema.xsd.maxoccurs}")
99 protected String maxOccurs;
101 protected static final String SERVICE_NAME = "JUNIT";
104 public static void setupBundleconfig() throws Exception {
105 System.setProperty("AJSC_HOME", ".");
106 System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
107 System.setProperty("aai.service.name", SERVICE_NAME);
108 QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"),
109 "src/test/resources/bundleconfig-local/etc/oxm/");