e39b0b3c162e4d48a464fa295f4d020bce8d2d34
[aai/router-core.git] / src / test / java / org / onap / aai / entity / OxmEntityDescriptorTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 package org.onap.aai.entity;
22
23 import org.junit.Assert;
24 import org.junit.Test;
25 import org.onap.aai.util.CrossEntityReference;
26
27 import java.io.IOException;
28 import java.security.NoSuchAlgorithmException;
29 import java.util.ArrayList;
30 import java.util.HashMap;
31 import java.util.List;
32 import java.util.Map;
33
34 public class OxmEntityDescriptorTest {
35
36     @Test
37     public void testOxmEntityDescriptor(){
38         OxmEntityDescriptor descriptor = new OxmEntityDescriptor();
39         descriptor.setEntityName("entity-1");
40         Assert.assertEquals(descriptor.getEntityName(), "entity-1");
41
42         descriptor.setPrimaryKeyAttributeName(new ArrayList<String>());
43         Assert.assertTrue(descriptor.getPrimaryKeyAttributeName().size()==0);
44
45         Assert.assertFalse(descriptor.hasSearchableAttributes());
46
47         List<String> searchableAttr = new ArrayList<String>();
48         searchableAttr.add("search");
49         descriptor.setSearchableAttributes(searchableAttr);
50         Assert.assertTrue(descriptor.getSearchableAttributes().size()==1);
51
52         Assert.assertTrue(descriptor.hasSearchableAttributes());
53
54         CrossEntityReference ref = new CrossEntityReference();
55         descriptor.setCrossEntityReference(ref);
56         Assert.assertEquals(descriptor.getCrossEntityReference(), ref);
57
58         descriptor.setSuggestableEntity(true);
59         Assert.assertTrue(descriptor.isSuggestableEntity());
60
61         Assert.assertNotNull(descriptor.toString());
62     }
63 }