diff options
Diffstat (limited to 'model/src/test/java/org/onap/policy/apex/model/policymodel/utils/SupportPolicyModelValidator.java')
-rw-r--r-- | model/src/test/java/org/onap/policy/apex/model/policymodel/utils/SupportPolicyModelValidator.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/model/src/test/java/org/onap/policy/apex/model/policymodel/utils/SupportPolicyModelValidator.java b/model/src/test/java/org/onap/policy/apex/model/policymodel/utils/SupportPolicyModelValidator.java new file mode 100644 index 000000000..daff1efa7 --- /dev/null +++ b/model/src/test/java/org/onap/policy/apex/model/policymodel/utils/SupportPolicyModelValidator.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.model.policymodel.utils; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; + +/** + * Main class to run the policy model validator. + */ +public class SupportPolicyModelValidator { + /** + * Main method. + * @param args the command line arguments + * @throws ApexModelException on errors on the apex model + * @throws FileNotFoundException on file find failures + */ + public static void main(final String[] args) throws ApexModelException, FileNotFoundException { + final ApexModelReader<AxPolicyModel> policyModelReader = new ApexModelReader<AxPolicyModel>( + AxPolicyModel.class); + + final AxPolicyModel policyModel = policyModelReader.read(new FileInputStream(args[0])); + final AxValidationResult result = policyModel.validate(new AxValidationResult()); + System.out.println(result); + } +} |