12051fb07d4ba055b79515d4e26a00dabff1c8c6
[so.git] / graph-inventory / aai-client / src / test / java / org / onap / aaiclient / client / aai / AAIObjectTypeTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.aaiclient.client.aai;
22
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;
27
28 public class AAIObjectTypeTest {
29
30     @Test
31     public void fromTypeNameTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
32         AAIObjectType type = AAIObjectType.fromTypeName("generic-query");
33         assertEquals("generic-query", type.typeName());
34
35     }
36
37     @Test
38     public void customTypeTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
39         AAIObjectType type = AAIObjectType.fromTypeName("my-custom-name");
40         assertEquals("my-custom-name", type.typeName());
41
42     }
43
44     @Test
45     public void equalityTest() {
46
47         AAIObjectType genericVnf = AAIFluentTypeBuilder.network().genericVnf("test").build();
48         AAIObjectType genericVnf2 = AAIFluentTypeBuilder.network().genericVnf("test2").build();
49
50         assertEquals(genericVnf2, genericVnf);
51
52         assertEquals(genericVnf, Types.GENERIC_VNF);
53
54     }
55
56     @Test
57     public void uriParamTest() {
58
59         assertEquals("vnf-id", AAIFluentTypeBuilder.Types.GENERIC_VNF.getUriParams().vnfId);
60
61         assertEquals("l-interface.interface-name", AAIFluentTypeBuilder.Types.L_INTERFACE.getUriParams().interfaceName);
62
63         assertEquals("cloud-owner", AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner);
64
65         assertEquals("cloud-region-id", AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId);
66
67
68     }
69 }