Replaced all tabs with spaces in java and pom.xml
[so.git] / common / src / test / java / org / onap / so / client / aai / entities / RelationshipsTest.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.so.client.aai.entities;
22
23 import static org.junit.Assert.assertTrue;
24 import java.io.IOException;
25 import java.nio.file.Files;
26 import java.nio.file.Paths;
27 import java.util.Arrays;
28 import java.util.List;
29 import org.junit.Test;
30 import org.onap.so.client.aai.AAIObjectType;
31 import org.onap.so.client.aai.entities.uri.AAIResourceUri;
32 import org.onap.so.client.aai.entities.uri.AAIUriFactory;
33
34 public class RelationshipsTest {
35
36     private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
37
38     @Test
39     public void run() throws IOException {
40         final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json")));
41
42         AAIResultWrapper wrapper = new AAIResultWrapper(content);
43         Relationships relationships = wrapper.getRelationships().get();
44
45         List<AAIResourceUri> test = relationships.getRelatedUris(AAIObjectType.VCE);
46
47         System.out.println(test.get(0).build());
48         List<AAIResourceUri> uris = Arrays.asList(
49                 AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"),
50                 AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"),
51                 AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"),
52                 AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"));
53
54
55         assertTrue(uris.containsAll(test) && test.containsAll(uris));
56
57     }
58
59 }