2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 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=========================================================
21 package org.onap.aaiclient.client.aai;
23 import static org.junit.Assert.assertEquals;
24 import org.junit.Test;
25 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
26 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
28 public class AAIObjectTypeTest {
31 public void fromTypeNameTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
32 AAIObjectType type = AAIObjectType.fromTypeName("generic-query");
33 assertEquals("generic-query", type.typeName());
38 public void customTypeTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
39 AAIObjectType type = AAIObjectType.fromTypeName("my-custom-name");
40 assertEquals("my-custom-name", type.typeName());
45 public void equalityTest() {
47 AAIObjectType genericVnf = AAIFluentTypeBuilder.network().genericVnf("test").build();
48 AAIObjectType genericVnf2 = AAIFluentTypeBuilder.network().genericVnf("test2").build();
50 assertEquals(genericVnf2, genericVnf);
52 assertEquals(genericVnf, Types.GENERIC_VNF);
57 public void uriParamTest() {
59 assertEquals("vnf-id", AAIFluentTypeBuilder.Types.GENERIC_VNF.getUriParams().vnfId);
61 assertEquals("l-interface.interface-name", AAIFluentTypeBuilder.Types.L_INTERFACE.getUriParams().interfaceName);
63 assertEquals("cloud-owner", AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner);
65 assertEquals("cloud-region-id", AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId);