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.so.client.aai.entities.uri;
23 import static org.junit.Assert.assertEquals;
24 import javax.ws.rs.core.UriBuilder;
25 import org.junit.Test;
26 import org.onap.so.client.aai.AAIObjectType;
28 public class AAISimpleUriFromUriTest {
33 public void removeHost() {
35 AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
37 .fromUri("https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053")
40 assertEquals("root and version removed", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053",
41 uri.build().toString());
46 public void noChange() {
48 AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
49 UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
51 assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
56 public void encodingPreserved() {
58 AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
59 UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
61 assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053",
62 uri.build().toString());
67 public void beforeBuildEquality() {
69 AAIResourceUri uri = new AAISimpleUri(AAIObjectType.VCE,
70 UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
72 AAIResourceUri uri2 = new AAISimpleUri(AAIObjectType.VCE, "a9f ec18e-1ea3-40e4-a6c0-a89b3de07053");
73 assertEquals("are equal", uri2, uri);