2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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.entities.uri;
23 import static org.hamcrest.CoreMatchers.equalTo;
24 import org.junit.Rule;
25 import org.junit.Test;
26 import org.junit.rules.ExpectedException;
27 import org.onap.aaiclient.client.aai.AAIObjectPlurals;
28 import org.onap.aaiclient.client.aai.AAIObjectType;
29 import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
31 public class IncorrectNumberOfUriKeysTest {
34 public ExpectedException thrown = ExpectedException.none();
37 public void verifyIncorrectNumberOfKeysSingle() {
39 thrown.expect(IncorrectNumberOfUriKeys.class);
40 thrown.expectMessage(equalTo("Expected 3 variables: [cloud-owner, cloud-region-id, volume-group-id]"));
41 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, "volume-group-id");
46 public void verifyIncorrectNumberOfKeysPlural() {
48 thrown.expect(IncorrectNumberOfUriKeys.class);
49 AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner");
54 public void verifyIncorrectNumberOfKeysFromParent() {
56 thrown.expect(IncorrectNumberOfUriKeys.class);
57 AAIResourceUri parentUri =
58 AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "my-cloud-owner", "my-cloud-region-id");
59 AAIResourceUri uri = AAIUriFactory.createResourceFromParentURI(parentUri, AAIObjectType.VOLUME_GROUP);
63 public void verifyIncorrectNumberOfKeysHttpAware() {
65 thrown.expect(IncorrectNumberOfUriKeys.class);
67 AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "customer-id", "subscription-id");