diff options
Diffstat (limited to 'aai-schema-ingest')
21 files changed, 463 insertions, 152 deletions
diff --git a/aai-schema-ingest/pom.xml b/aai-schema-ingest/pom.xml index 1717ad41..76b11f42 100644 --- a/aai-schema-ingest/pom.xml +++ b/aai-schema-ingest/pom.xml @@ -1,13 +1,24 @@ -<!-- ============LICENSE_START======================================================= - org.onap.aai ================================================================================ - Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); you may not - use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required - by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> +<!-- + +============LICENSE_START====================================================== +org.onap.aai +=============================================================================== +Copyright © 2019 AT&T Intellectual Property. All rights reserved. +=============================================================================== +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +===========LICENSE_END========================================================= + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> @@ -34,7 +45,7 @@ <artifactId>maven-source-plugin</artifactId> </plugin> <plugin> - <!-- explicitly define maven-deploy-plugin after other to force exec + <!-- explicitly define maven-deploy-plugin after other to force exec order --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java index a6675d43..0bb36a2d 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java @@ -22,8 +22,8 @@ package org.onap.aai.config; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Arrays; import java.util.HashSet; @@ -49,7 +49,7 @@ public class NodesConfiguration { private static final String CONFIG_TRANSLATOR = "config"; private static final String SCHEMA_SERVICE_TRANSLATOR = "schema-service"; - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(NodesConfiguration.class); + private static final Logger LOGGER = LoggerFactory.getLogger(NodesConfiguration.class); @Autowired(required = false) SchemaServiceConfiguration schemaConfiguration; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java index 4074b425..529c0684 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java @@ -44,21 +44,6 @@ public class RestConfiguration { @Value("${schema.service.client:one-way-ssl}") private String schemaServiceClient; - @Autowired - private RestClient restClient; - - @Bean - public RestClientFactory restClientFactory() { - - return new RestClientFactory() { - @Override - public RestClient getRestClient(String clientType) { - return restClient; - - } - }; - } - /* * In the below cases bean name and method names are different because all of them qualify as restClient */ diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java index 245dce97..cdd87492 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/SchemaServiceConfiguration.java @@ -44,7 +44,7 @@ public class SchemaServiceConfiguration { return schemaVersionsBean().getSchemaVersions(); } - @Bean(name = "schemaVersions2") + @Bean(name = "schemaVersions") public SchemaVersions schemaVersions() { return schemaServiceVersions(); } diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java index 3cf67052..002ec1ee 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java @@ -23,8 +23,8 @@ package org.onap.aai.edges; import static com.jayway.jsonpath.Criteria.where; import static com.jayway.jsonpath.Filter.filter; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; @@ -60,7 +60,7 @@ import org.springframework.stereotype.Component; */ @Component public class EdgeIngestor { - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(EdgeIngestor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EdgeIngestor.class); private Map<SchemaVersion, List<DocumentContext>> versionJsonFilesMap = new TreeMap<>(); private static final String READ_START = "$.rules.[?]"; private static final String READ_ALL_START = "$.rules.*"; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeRule.java b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeRule.java index d3c9a599..68def753 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeRule.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeRule.java @@ -20,13 +20,13 @@ package org.onap.aai.edges; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.onap.aai.edges.enums.*; + import java.util.EnumMap; import java.util.HashMap; import java.util.Map; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.onap.aai.edges.enums.*; - /** * Container for A&AI edge rule information */ @@ -43,7 +43,7 @@ public class EdgeRule { /** * Instantiates a new edge rule. - * + * * @param fieldVals - Map<String, String> where first string is * an EdgeField value and second string is the * value of that field @@ -56,14 +56,14 @@ public class EdgeRule { label = fieldVals.get(EdgeField.LABEL.toString()); direction = Direction.valueOf(fieldVals.get(EdgeField.DIRECTION.toString())); multiplicityRule = MultiplicityRule.getValue(fieldVals.get(EdgeField.MULTIPLICITY.toString())); - isPrivateEdge = Boolean.valueOf(fieldVals.getOrDefault(EdgeField.PRIVATE.toString(), "false")); + isPrivateEdge = Boolean.parseBoolean(fieldVals.getOrDefault(EdgeField.PRIVATE.toString(), "false")); for (EdgeProperty prop : EdgeProperty.values()) { String rawVal = fieldVals.get(prop.toString()); edgeFields.put(prop, convertNotation(direction, rawVal)); } - isDefaultEdge = Boolean.valueOf(fieldVals.get(EdgeField.DEFAULT.toString())); + isDefaultEdge = Boolean.parseBoolean(fieldVals.get(EdgeField.DEFAULT.toString())); description = fieldVals.get(EdgeField.DESCRIPTION.toString()); if (description == null) { // bc description is optional and not in v12 and earlier description = ""; @@ -86,7 +86,7 @@ public class EdgeRule { /** * Converts whatever string was in the json for an edge property value into * the appropriate AAIDirection - * + * * @param Direction dir - the edge direction * @param String rawVal - property value from the json, may be * IN, OUT, BOTH, NONE, ${direction}, or !${direction} @@ -114,7 +114,7 @@ public class EdgeRule { /** * Gets the name of the node type in the "from" field - * + * * @return String nodetype */ public String getFrom() { @@ -123,7 +123,7 @@ public class EdgeRule { /** * Gets the name of the node type in the "to" field - * + * * @return String nodetype */ public String getTo() { @@ -177,7 +177,7 @@ public class EdgeRule { /** * Gets the value of the prevent-delete property - * + * * @return String prevent-delete property value */ public String getPreventDelete() { @@ -186,7 +186,7 @@ public class EdgeRule { /** * Returns if this rule is a default or not - * + * * @return boolean */ public boolean isDefault() { @@ -195,7 +195,7 @@ public class EdgeRule { /** * Gets the description on the edge rule (if there is one) - * + * * @return String description */ public String getDescription() { diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/edges/JsonIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/edges/JsonIngestor.java index b686b3a6..9b1f0bd9 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/edges/JsonIngestor.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/edges/JsonIngestor.java @@ -20,8 +20,8 @@ package org.onap.aai.edges; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; @@ -40,7 +40,7 @@ import org.onap.aai.setup.SchemaVersion; * JsonIngestor produces DocumentContexts from json files */ public class JsonIngestor { - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(JsonIngestor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(JsonIngestor.class); /** * Reads in given json files to queryable DocumentContexts. diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java index 6016fcca..139eb625 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java @@ -22,8 +22,8 @@ package org.onap.aai.nodes; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.base.CaseFormat; import java.io.*; @@ -62,7 +62,7 @@ import org.xml.sax.SAXException; @PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true) public class NodeIngestor { - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(NodeIngestor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(NodeIngestor.class); private static final Pattern classNamePattern = Pattern.compile("\\.(v\\d+)\\."); private Map<SchemaVersion, DynamicJAXBContext> versionContextMap = new HashMap<>(); private Map<SchemaVersion, Set<String>> typesPerVersion = new HashMap<>(); diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java index cc88edef..a92005ea 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java @@ -20,34 +20,24 @@ package org.onap.aai.restclient; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.util.Collections; -import java.util.Map; -import java.util.UUID; - -import javax.annotation.PostConstruct; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; import org.springframework.util.MultiValueMap; -@Component(value = "no-auth-service-rest-client") +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + public class SchemaServiceNoAuthClient extends NoAuthRestClient { - private static EELFLogger logger = EELFManager.getInstance().getLogger(SchemaServiceNoAuthClient.class); + private static Logger logger = LoggerFactory.getLogger(SchemaServiceNoAuthClient.class); @Value("${schema.service.base.url}") private String baseUrl; - @PostConstruct - public void init() throws Exception { - super.init(); - } - @Override public String getBaseUrl() { return baseUrl; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java index 6b107285..1ab0999e 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java @@ -20,25 +20,20 @@ package org.onap.aai.restclient; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.util.Collections; -import java.util.Map; -import java.util.UUID; - -import javax.annotation.PostConstruct; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; import org.springframework.util.MultiValueMap; -@Component(value = "schema-service-one-way-rest-client") +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + public class SchemaServiceOneWayClient extends OneWaySSLRestClient { - private static EELFLogger logger = EELFManager.getInstance().getLogger(SchemaServiceOneWayClient.class); + private static Logger logger = LoggerFactory.getLogger(SchemaServiceOneWayClient.class); @Value("${schema.service.base.url}") private String baseUrl; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java index 56ddd744..62f4b68b 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java @@ -22,22 +22,19 @@ package org.onap.aai.restclient; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.util.Collections; -import java.util.Map; -import java.util.UUID; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; import org.springframework.util.MultiValueMap; -@Component(value = "schema-service-rest-client") +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + public class SchemaServiceRestClient extends TwoWaySSLRestClient { - private static EELFLogger logger = EELFManager.getInstance().getLogger(SchemaServiceRestClient.class); + private static Logger logger = LoggerFactory.getLogger(SchemaServiceRestClient.class); @Value("${schema.service.base.url}") private String baseUrl; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java index 1c49e1de..a62dd17b 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java @@ -20,8 +20,8 @@ package org.onap.aai.setup; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.*; import java.nio.charset.Charset; @@ -40,7 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired; * */ public abstract class ConfigTranslator extends Translator { - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ConfigTranslator.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ConfigTranslator.class); protected SchemaLocationsBean bean; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java index 8c29f96d..4ee93fad 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java @@ -20,8 +20,8 @@ package org.onap.aai.setup; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.*; import java.util.*; @@ -29,8 +29,8 @@ import java.util.*; import javax.ws.rs.HttpMethod; import org.onap.aai.restclient.RestClient; -import org.onap.aai.restclient.RestClientFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.Resource; import org.springframework.http.HttpHeaders; @@ -45,7 +45,7 @@ import org.springframework.http.ResponseEntity; */ public class SchemaServiceTranslator extends Translator { - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(SchemaServiceTranslator.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SchemaServiceTranslator.class); private static final String SchemaServiceClientType = "schema.service"; @@ -55,8 +55,9 @@ public class SchemaServiceTranslator extends Translator { @Value("${schema.service.edges.endpoint}") private String edgeSchemaUri; + @Qualifier("restClient") @Autowired - private RestClientFactory restClientFactory; + private RestClient restClient; public SchemaServiceTranslator(SchemaVersions schemaVersions) { super(schemaVersions); @@ -64,7 +65,7 @@ public class SchemaServiceTranslator extends Translator { /* * (non-Javadoc) - * + * * @see org.onap.aai.setup.ConfigTranslator#getNodeFiles() */ @@ -78,7 +79,6 @@ public class SchemaServiceTranslator extends Translator { headersMap.put(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML.toString()); headersMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML.toString()); - RestClient restClient = restClientFactory.getRestClient(SchemaServiceClientType); ResponseEntity<Resource> schemaResponse = restClient.getGetResource(content, uri, headersMap); verifySchemaServiceResponse(schemaResponse.getStatusCode()); LOGGER.debug("SchemaResponse Status code" + schemaResponse.getStatusCode()); @@ -96,8 +96,6 @@ public class SchemaServiceTranslator extends Translator { String uri = edgeSchemaUri + version.toString(); Map<String, String> headersMap = new HashMap<>(); - RestClient restClient = restClientFactory.getRestClient(SchemaServiceClientType); - ResponseEntity<String> schemaResponse = restClient.getGetRequest(content, uri, headersMap); verifySchemaServiceResponse(schemaResponse.getStatusCode()); LOGGER.debug("SchemaResponse Status code" + schemaResponse.getStatusCode()); diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java index 68678b83..90b05e38 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersionsBean.java @@ -31,8 +31,8 @@ import java.util.Map; import javax.annotation.PostConstruct; import org.onap.aai.restclient.RestClient; -import org.onap.aai.restclient.RestClientFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; @@ -47,12 +47,13 @@ public class SchemaVersionsBean { @Value("${schema.service.versions.override:false}") private String overrideSchemaService; - @Autowired - private RestClientFactory restClientFactory; - @Autowired(required = false) private SchemaConfigVersions schemaConfigVersions; + @Qualifier("restClient") + @Autowired + private RestClient restClient; + @PostConstruct public void initialize() { // Call SchemaService to get versions @@ -65,7 +66,6 @@ public class SchemaVersionsBean { */ String content = ""; Map<String, String> headersMap = new HashMap<>(); - RestClient restClient = restClientFactory.getRestClient(SCHEMA_SERVICE); ResponseEntity<String> schemaResponse = restClient.getGetRequest(content, versionsUri, headersMap); Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES).create(); diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/CheckEverythingStrategy.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/CheckEverythingStrategy.java index 3f0ee41f..d16e3cc7 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/CheckEverythingStrategy.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/CheckEverythingStrategy.java @@ -59,7 +59,7 @@ public class CheckEverythingStrategy implements SchemaErrorStrategy { if (errorMsgs.isEmpty()) { return "No errors found."; } else { - return StringUtils.join(errorMsgs, "\n"); + return StringUtils.join(errorMsgs.iterator(), "\n"); } } diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockProvider.java b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockProvider.java index f0fed324..09b8d3a7 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockProvider.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockProvider.java @@ -35,21 +35,6 @@ public class MockProvider { @Value("${mock.filename}") private String fileName; - @Autowired - private RestClient restClient; - - @Bean - public RestClientFactory restClientFactory() { - - return new RestClientFactory() { - @Override - public RestClient getRestClient(String clientType) { - return restClient; - - } - }; - } - @Bean(name = "restClient") @ConditionalOnProperty(name = "schema.service.client", havingValue = "mock-no-auth") public RestClient getSchemaServiceNoAuthClient() { diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java index 52e6364b..6c23301b 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java @@ -24,7 +24,8 @@ import static org.junit.Assert.assertNotNull; import static org.springframework.test.web.client.match.MockRestRequestMatchers.*; import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus; -import com.att.eelf.configuration.EELFLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -288,7 +289,7 @@ public class MockRestClient extends RestClient { return null; } - protected EELFLogger getLogger() { + protected Logger getLogger() { return null; } diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/RestClientTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/RestClientTest.java deleted file mode 100644 index 36b8fb3e..00000000 --- a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/RestClientTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.aai.restclient; - -public class RestClientTest { - -} diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java index b7688472..af94765f 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java @@ -27,12 +27,10 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:forWiringTests/testUsingPropFileContext.xml"}) -@TestPropertySource(locations="classpath:forWiringTests/schema-ingest-for-xml-test.properties") public class SchemaLocationsBeanXMLSetterWithPropFileTest { @Autowired SchemaLocationsBean bean; diff --git a/aai-schema-ingest/src/test/resources/edgeRules/test_v16.json b/aai-schema-ingest/src/test/resources/edgeRules/test_v16.json new file mode 100644 index 00000000..0932014c --- /dev/null +++ b/aai-schema-ingest/src/test/resources/edgeRules/test_v16.json @@ -0,0 +1,275 @@ +{ + "rules": [ + { + "from": "foo", + "to": "bar", + "label": "eats", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "description": "Hard to describe" + }, + { + "from": "foo", + "to": "bar", + "label": "eatz", + "direction": "IN", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "description": "Hard to describe" + }, + { + "from": "foo", + "to": "baz", + "label": "isVeryHappyAbout", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "${direction}", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "description": "Hard to describe" + }, + { + "from": "quux", + "to": "foo", + "label": "dancesWith", + "direction": "IN", + "multiplicity": "One2Many", + "contains-other-v": "!${direction}", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "description": "Hard to describe" + }, + { + "from": "foo", + "to": "dog", + "label": "pets", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "description": "Hard to describe" + }, + { + "from": "dog", + "to": "puppy", + "label": "caresFor", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "description": "Hard to describe", + "default": "true" + }, + { + "from": "l-interface", + "to": "logical-link", + "label": "tosca.relationships.network.LinksTo", + "direction": "OUT", + "multiplicity": "MANY2MANY", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "default": "true", + "description":"" + }, + { + "from": "logical-link", + "to": "l-interface", + "label": "org.onap.relationships.inventory.Source", + "direction": "OUT", + "multiplicity": "ONE2MANY", + "contains-other-v": "NONE", + "delete-other-v": "!${direction}", + "prevent-delete": "NONE", + "default": "false", + "description":"" + }, + { + "from": "logical-link", + "to": "l-interface", + "label": "org.onap.relationships.inventory.Destination", + "direction": "OUT", + "multiplicity": "ONE2MANY", + "contains-other-v": "NONE", + "delete-other-v": "!${direction}", + "prevent-delete": "NONE", + "default": "false", + "description":"" + }, + { + "from": "l-interface", + "to": "lag-interface", + "label": "org.onap.relationships.inventory.BelongsTo", + "direction": "OUT", + "multiplicity": "MANY2ONE", + "contains-other-v": "!${direction}", + "delete-other-v": "!${direction}", + "prevent-delete": "NONE", + "default": "true", + "description":"" + }, + { + "from": "lag-interface", + "to": "logical-link", + "label": "org.onap.relationships.inventory.Uses", + "direction": "OUT", + "multiplicity": "MANY2MANY", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "prevent-delete": "NONE", + "default": "true", + "description":"" + }, + { + "from": "bloop", + "to": "bloop", + "label": "links", + "direction": "OUT", + "multiplicity": "ONE2ONE", + "contains-other-v": "IN", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "default": "true", + "description": "for testing same type direction flip requirement" + }, + { + "from": "parent", + "to": "notation", + "label": "has", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "${direction}", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contains notation" + }, + { + "from": "not-notation", + "to": "parent", + "label": "contains", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "!${direction}", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contains not-notation" + }, + { + "from": "parent", + "to": "out-out", + "label": "eats", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "OUT", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contains out-out" + }, + { + "from": "parent", + "to": "in-in", + "label": "verbs", + "direction": "IN", + "multiplicity": "Many2Many", + "contains-other-v": "IN", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contains in-in" + }, + { + "from": "out-in", + "to": "parent", + "label": "alarms", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "IN", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contains out-in" + }, + { + "from": "in-out", + "to": "parent", + "label": "befriends", + "direction": "IN", + "multiplicity": "Many2Many", + "contains-other-v": "OUT", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contains in-out" + }, + { + "from": "parent", + "to": "grandparent1", + "label": "has", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "!${direction}", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contained by grandparent1" + }, + { + "from": "grandparent2", + "to": "parent", + "label": "contains", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "${direction}", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contained by grandparent2" + }, + { + "from": "parent", + "to": "grandparent3", + "label": "eats", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "IN", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contained by grandparent3" + }, + { + "from": "parent", + "to": "grandparent4", + "label": "verbs", + "direction": "IN", + "multiplicity": "Many2Many", + "contains-other-v": "OUT", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contained by grandparent4" + }, + { + "from": "grandparent5", + "to": "parent", + "label": "alarms", + "direction": "OUT", + "multiplicity": "Many2Many", + "contains-other-v": "OUT", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contained by grandparent5" + }, + { + "from": "grandparent6", + "to": "parent", + "label": "befriends", + "direction": "IN", + "multiplicity": "Many2Many", + "contains-other-v": "IN", + "delete-other-v": "NONE", + "prevent-delete": "NONE", + "description": "parent contained by grandparent6" + } + ] +} diff --git a/aai-schema-ingest/src/test/resources/oxm/test_combined_network_business_v16.xml b/aai-schema-ingest/src/test/resources/oxm/test_combined_network_business_v16.xml new file mode 100644 index 00000000..b167ce55 --- /dev/null +++ b/aai-schema-ingest/src/test/resources/oxm/test_combined_network_business_v16.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="inventory.aai.onap.org.v16" xml-mapping-metadata-complete="true"> + <xml-schema element-form-default="QUALIFIED"> + <xml-ns namespace-uri="http://org.onap.aai.inventory/v16" /> + </xml-schema> + <java-types> + + <java-type name="Foo"> + <xml-root-element name="foo" /> + <java-attributes> + <xml-element java-attribute="fooId" name="foo-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of Foo. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="fooName" name="foo-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of Foo." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="quantity" name="quantity" required="false" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="How many." /> + </xml-properties> + </xml-element> + + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose metasyntactic variable" /> + <xml-property name="nameProps" value="foo-name" /> + <xml-property name="uniqueProps" value="foo-id" /> + </xml-properties> + </java-type> + + <java-type name="Quux"> + <xml-root-element name="quux" /> + <java-attributes> + <xml-element java-attribute="qManagerName" name="q-manager-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of Quux owner. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="color" name="color" required="false" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="color" /> + </xml-properties> + </xml-element> + + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose metasyntactic variable" /> + </xml-properties> + </java-type> + + <java-type name="Bar"> + <xml-root-element name="bar" /> + <java-attributes> + <xml-element java-attribute="barId" name="bar-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of Bar This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="quantity" name="quantity" required="false" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="How many." /> + </xml-properties> + </xml-element> + + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose metasyntactic variable" /> + <xml-property name="uniqueProps" value="bar-id" /> + </xml-properties> + </java-type> + + + </java-types> +</xml-bindings> + + + |