2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-18 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 package org.onap.aai.validation;
26 import java.util.List;
29 import org.onap.aai.setup.ConfigTranslator;
30 import org.onap.aai.setup.SchemaVersion;
31 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.stereotype.Component;
35 * By default, A&AI must have schema files for all current
36 * supported Versions in the Version enum
40 public class DefaultVersionValidationModule implements VersionValidationModule {
42 private ConfigTranslator config;
45 public DefaultVersionValidationModule(ConfigTranslator config) {
51 * @see org.onap.aai.validation.VersionValidationModule#validate(org.onap.aai.setup.ConfigTranslator)
54 public String validate() {
55 Map<SchemaVersion, List<String>> nodeConfig = config.getNodeFiles();
56 Map<SchemaVersion, List<String>> edgeConfig = config.getEdgeFiles();
58 StringBuilder missingVers = new StringBuilder().append("Missing schema for the following versions: ");
59 boolean isMissing = false;
60 for (SchemaVersion v : config.getSchemaVersions().getVersions()) {
61 if (nodeConfig.get(v) == null) {
63 missingVers.append(v.toString()).append(" has no OXM configured. ");
65 if (edgeConfig.get(v) == null) {
67 missingVers.append(v.toString()).append(" has no edge rules configured. ");
72 return missingVers.toString();