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=========================================================
20 package org.onap.aai.introspection.tools;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.onap.aai.AAISetup;
25 import org.onap.aai.introspection.*;
26 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
28 import static org.junit.Assert.assertFalse;
29 import static org.junit.Assert.assertTrue;
31 public class CreateUUIDTest extends AAISetup {
33 private CreateUUID createUUID;
35 private Loader loader;
40 createUUID = new CreateUUID();
41 loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
45 * Tests to check if the issue is not resolvable since
46 * the property that is being tested doesn't have the auto generated uuid
47 * metadata set to true in the oxm xml for the version specified
49 * @throws AAIUnknownObjectException - if the object type specified is unable to be found in the oxm
52 public void testNonResolvableIssueIfMissingPropNameThatIsRequired() throws AAIUnknownObjectException {
54 Introspector introspector = loader.introspectorFromName("pserver");
57 issue.setDetail("Some message");
58 issue.setType(IssueType.MISSING_KEY_PROP);
59 issue.setPropName("hostname");
60 issue.setIntrospector(introspector);
62 boolean isIssue = createUUID.resolveIssue(issue);
68 * Tests when there is a resolvable issue when the property
69 * looking for, model-element-uuid, has the auto generated uuid
70 * metadata attribute associated to it if the data is missing
72 * @throws AAIUnknownObjectException - if the object type specified is unable to be found in the oxm
75 public void testResolvableIssueWhenMissingPropNameAllowsToUseGeneratedUUID() throws AAIUnknownObjectException {
77 Introspector introspector = loader.introspectorFromName("model-element");
80 issue.setDetail("Some message");
81 issue.setType(IssueType.MISSING_KEY_PROP);
82 issue.setPropName("model-element-uuid");
83 issue.setIntrospector(introspector);
85 boolean isIssue = createUUID.resolveIssue(issue);