2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.introspection.tools;
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.onap.aai.AAISetup;
27 import org.onap.aai.introspection.*;
28 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
30 import static org.junit.Assert.assertFalse;
31 import static org.junit.Assert.assertTrue;
33 public class CreateUUIDTest extends AAISetup {
35 private CreateUUID createUUID;
37 private Loader loader;
42 createUUID = new CreateUUID();
43 loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest());
47 * Tests to check if the issue is not resolvable since
48 * the property that is being tested doesn't have the auto generated uuid
49 * metadata set to true in the oxm xml for the version specified
51 * @throws AAIUnknownObjectException - if the object type specified is unable to be found in the oxm
54 public void testNonResolvableIssueIfMissingPropNameThatIsRequired() throws AAIUnknownObjectException {
56 Introspector introspector = loader.introspectorFromName("pserver");
59 issue.setDetail("Some message");
60 issue.setType(IssueType.MISSING_KEY_PROP);
61 issue.setPropName("hostname");
62 issue.setIntrospector(introspector);
64 boolean isIssue = createUUID.resolveIssue(issue);
70 * Tests when there is a resolvable issue when the property
71 * looking for, model-element-uuid, has the auto generated uuid
72 * metadata attribute associated to it if the data is missing
74 * @throws AAIUnknownObjectException - if the object type specified is unable to be found in the oxm
77 public void testResolvableIssueWhenMissingPropNameAllowsToUseGeneratedUUID() throws AAIUnknownObjectException {
79 Introspector introspector = loader.introspectorFromName("model-element");
82 issue.setDetail("Some message");
83 issue.setType(IssueType.MISSING_KEY_PROP);
84 issue.setPropName("model-element-uuid");
85 issue.setIntrospector(introspector);
87 boolean isIssue = createUUID.resolveIssue(issue);