2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.vnfmadapter.rest;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25 import static org.mockito.ArgumentMatchers.eq;
26 import static org.mockito.Mockito.doReturn;
27 import static org.mockito.Mockito.verify;
28 import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
29 import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
30 import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
31 import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
32 import com.google.gson.Gson;
34 import java.util.Optional;
35 import org.hamcrest.BaseMatcher;
36 import org.hamcrest.Description;
37 import org.hamcrest.core.StringStartsWith;
38 import org.junit.Before;
39 import org.junit.Test;
40 import org.junit.runner.RunWith;
41 import org.mockito.ArgumentCaptor;
42 import org.mockito.hamcrest.MockitoHamcrest;
43 import org.onap.aai.domain.yang.EsrSystemInfo;
44 import org.onap.aai.domain.yang.EsrSystemInfoList;
45 import org.onap.aai.domain.yang.EsrVnfm;
46 import org.onap.aai.domain.yang.EsrVnfmList;
47 import org.onap.aai.domain.yang.GenericVnf;
48 import org.onap.aai.domain.yang.Relationship;
49 import org.onap.aai.domain.yang.RelationshipData;
50 import org.onap.aai.domain.yang.RelationshipList;
51 import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
52 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
53 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
54 import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
55 import org.onap.so.client.aai.AAIResourcesClient;
56 import org.onap.so.client.aai.entities.uri.AAIResourceUri;
57 import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
58 import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
59 import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
60 import org.onap.vnfmadapter.v1.model.OperationEnum;
61 import org.onap.vnfmadapter.v1.model.OperationStateEnum;
62 import org.onap.vnfmadapter.v1.model.QueryJobResponse;
63 import org.onap.vnfmadapter.v1.model.Tenant;
64 import org.springframework.beans.factory.annotation.Autowired;
65 import org.springframework.beans.factory.annotation.Qualifier;
66 import org.springframework.boot.test.context.SpringBootTest;
67 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
68 import org.springframework.boot.test.mock.mockito.MockBean;
69 import org.springframework.boot.test.web.client.TestRestTemplate;
70 import org.springframework.boot.web.server.LocalServerPort;
71 import org.springframework.http.HttpStatus;
72 import org.springframework.http.MediaType;
73 import org.springframework.http.RequestEntity;
74 import org.springframework.http.ResponseEntity;
75 import org.springframework.test.context.ActiveProfiles;
76 import org.springframework.test.context.junit4.SpringRunner;
77 import org.springframework.test.web.client.MockRestServiceServer;
78 import org.springframework.web.client.RestTemplate;
79 import org.threeten.bp.LocalDateTime;
80 import org.threeten.bp.OffsetDateTime;
81 import org.threeten.bp.ZoneOffset;
84 @RunWith(SpringRunner.class)
85 @SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
86 @ActiveProfiles("test")
88 public class VnfmAdapterControllerTest {
90 private static final OffsetDateTime JAN_1_2019_12_00 =
91 OffsetDateTime.of(LocalDateTime.of(2019, 1, 1, 12, 0), ZoneOffset.UTC);
92 private static final OffsetDateTime JAN_1_2019_1_00 =
93 OffsetDateTime.of(LocalDateTime.of(2019, 1, 1, 1, 0), ZoneOffset.UTC);
94 private static final String CLOUD_OWNER = "myTestCloudOwner";
95 private static final String REGION = "myTestRegion";
96 private static final String TENANT_ID = "myTestTenantId";
101 @Qualifier(CONFIGURABLE_REST_TEMPLATE)
102 private RestTemplate testRestTemplate;
103 private MockRestServiceServer mockRestServer;
106 AAIResourcesClient aaiResourcesClient;
109 VnfmAdapterController controller;
110 Gson gson = new Gson();
113 public void setUp() throws Exception {
114 mockRestServer = MockRestServiceServer.bindTo(testRestTemplate).build();
118 public void createVnf_ValidRequest_Returns202AndJobId() throws Exception {
119 final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
120 final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
122 setUpGenericVnfInMockAai("vnfmType2");
123 setUpVnfmsInMockAai();
126 mockRestServer.expect(requestTo("http://dummy.value/until/create/implememted/vnfId"))
127 .andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
128 .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456")));
131 final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
132 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
133 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
134 mockRestServer.expect(requestTo("http://vnfm2:8080/vnf_lcm_op_occs/123456"))
135 .andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
137 final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
138 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
139 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
140 mockRestServer.expect(requestTo("http://vnfm2:8080/vnf_lcm_op_occs/123456"))
141 .andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
143 // Invoke the create request
145 final ResponseEntity<CreateVnfResponse> createVnfResponse =
146 controller.vnfCreate("myTestVnfId", createVnfRequest, "asadas", "so", "1213");
147 assertEquals(HttpStatus.ACCEPTED, createVnfResponse.getStatusCode());
148 assertNotNull(createVnfResponse.getBody().getJobId());
150 final ArgumentCaptor<GenericVnf> genericVnfArgument = ArgumentCaptor.forClass(GenericVnf.class);
151 final ArgumentCaptor<AAIResourceUri> uriArgument = ArgumentCaptor.forClass(AAIResourceUri.class);
153 verify(aaiResourcesClient).update(uriArgument.capture(), genericVnfArgument.capture());
155 assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId", uriArgument.getValue().build().toString());
157 assertEquals("myTestVnfId", genericVnfArgument.getValue().getVnfId());
158 assertEquals(1, genericVnfArgument.getValue().getRelationshipList().getRelationship().size());
159 final Relationship createdRelationship =
160 genericVnfArgument.getValue().getRelationshipList().getRelationship().get(0);
161 assertEquals("esr-vnfm", createdRelationship.getRelatedTo());
162 assertEquals("tosca.relationships.DependsOn", createdRelationship.getRelationshipLabel());
163 assertEquals("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/vnfm2", createdRelationship.getRelatedLink());
165 // check the job status
167 final ResponseEntity<QueryJobResponse> firstJobQueryResponse =
168 controller.jobQuery(createVnfResponse.getBody().getJobId(), "", "so", "1213");
169 assertEquals(OperationEnum.INSTANTIATE, firstJobQueryResponse.getBody().getOperation());
170 assertEquals(OperationStateEnum.PROCESSING, firstJobQueryResponse.getBody().getOperationState());
171 assertEquals(JAN_1_2019_12_00, firstJobQueryResponse.getBody().getStartTime());
172 assertEquals(JAN_1_2019_1_00, firstJobQueryResponse.getBody().getStateEnteredTime());
174 final ResponseEntity<QueryJobResponse> secondJobQueryResponse =
175 controller.jobQuery(createVnfResponse.getBody().getJobId(), "", "so", "1213");
176 assertEquals(OperationEnum.INSTANTIATE, secondJobQueryResponse.getBody().getOperation());
177 assertEquals(OperationStateEnum.COMPLETED, secondJobQueryResponse.getBody().getOperationState());
178 assertEquals(JAN_1_2019_12_00, secondJobQueryResponse.getBody().getStartTime());
179 assertEquals(JAN_1_2019_1_00, secondJobQueryResponse.getBody().getStateEnteredTime());
182 @Test(expected = IllegalArgumentException.class)
183 public void createVnf_VnfAlreadyExistsOnVnfm_ThrowsIllegalArgumentException() throws Exception {
184 final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
185 final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
187 final GenericVnf genericVnf = new GenericVnf();
188 genericVnf.setVnfId("myTestVnfId");
189 genericVnf.setNfType("vnfmType1");
190 genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm");
192 doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class),
193 MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId")));
195 final InlineResponse201 reponse = new InlineResponse201();
196 mockRestServer.expect(requestTo(new URI("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm")))
197 .andRespond(withSuccess(gson.toJson(reponse), MediaType.APPLICATION_JSON));
199 controller.vnfCreate("myTestVnfId", createVnfRequest, "asadas", "so", "1213");
202 @Test(expected = VnfmNotFoundException.class)
203 public void createVnf_NoMatchingVnfmFound_ThrowsException() throws Exception {
204 final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
205 final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
207 setUpGenericVnfInMockAai("anotherType");
208 setUpVnfmsInMockAai();
210 controller.vnfCreate("myTestVnfId", createVnfRequest, "asadas", "so", "1213");
214 public void createVnf_VnfmAlreadyAssociatedWithVnf_Returns202AndJobId() throws Exception {
215 final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
216 final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
218 setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType2", "vnfm1");
219 setUpVnfmsInMockAai();
222 mockRestServer.expect(requestTo("http://dummy.value/until/create/implememted/vnfId"))
223 .andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
224 .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456")));
226 final ResponseEntity<CreateVnfResponse> response =
227 controller.vnfCreate("myTestVnfId", createVnfRequest, "asadas", "so", "1213");
228 assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
229 assertNotNull(response.getBody().getJobId());
233 public void createVnf_UnauthorizedUser_Returns401() throws Exception {
234 final TestRestTemplate restTemplateWrongPassword = new TestRestTemplate("test", "wrongPassword");
235 final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
236 final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
238 final RequestEntity<CreateVnfRequest> request =
239 RequestEntity.post(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
240 .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
241 .header("X-ONAP-RequestId", "myRequestId").header("X-ONAP-InvocationID", "myInvocationId")
242 .body(createVnfRequest);
243 final ResponseEntity<CreateVnfResponse> response =
244 restTemplateWrongPassword.exchange(request, CreateVnfResponse.class);
245 assertEquals(401, response.getStatusCode().value());
249 public void deleteVnf_ValidRequest_Returns202AndJobId() throws Exception {
250 final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
251 final RequestEntity<Void> request = RequestEntity
252 .delete(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
253 .accept(MediaType.APPLICATION_JSON).header("X-ONAP-RequestId", "myRequestId")
254 .header("X-ONAP-InvocationID", "myInvocationId").header("Content-Type", "application/json").build();
255 final ResponseEntity<DeleteVnfResponse> deleteVnfResponse =
256 restTemplate.exchange(request, DeleteVnfResponse.class);
257 assertEquals(202, deleteVnfResponse.getStatusCode().value());
258 assertNotNull(deleteVnfResponse.getBody().getJobId());
261 final EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
262 esrSystemInfo.setServiceUrl("http://vnfm:8080");
263 esrSystemInfo.setType("vnfmType");
264 esrSystemInfo.setSystemType("VNFM");
265 final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
266 esrSystemInfoList.getEsrSystemInfo().add(esrSystemInfo);
268 doReturn(Optional.of(esrSystemInfoList)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
269 MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/...")));
271 final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
272 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
273 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
274 mockRestServer.expect(requestTo(new StringStartsWith("http://vnfm:8080/vnf_lcm_op_occs")))
275 .andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
278 final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
279 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
280 org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
281 mockRestServer.expect(requestTo(new StringStartsWith("http://vnfm:8080/vnf_lcm_op_occs")))
282 .andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
285 final ResponseEntity<QueryJobResponse> firstJobQueryResponse =
286 controller.jobQuery(deleteVnfResponse.getBody().getJobId(), "", "so", "1213");
287 assertEquals(OperationEnum.TERMINATE, firstJobQueryResponse.getBody().getOperation());
288 assertEquals(OperationStateEnum.PROCESSING, firstJobQueryResponse.getBody().getOperationState());
289 assertEquals(JAN_1_2019_12_00, firstJobQueryResponse.getBody().getStartTime());
290 assertEquals(JAN_1_2019_1_00, firstJobQueryResponse.getBody().getStateEnteredTime());
292 final ResponseEntity<QueryJobResponse> secondJobQueryResponse =
293 controller.jobQuery(deleteVnfResponse.getBody().getJobId(), "", "so", "1213");
294 assertEquals(OperationEnum.TERMINATE, secondJobQueryResponse.getBody().getOperation());
295 assertEquals(OperationStateEnum.PROCESSING, secondJobQueryResponse.getBody().getOperationState());
296 assertEquals(JAN_1_2019_12_00, secondJobQueryResponse.getBody().getStartTime());
297 assertEquals(JAN_1_2019_1_00, secondJobQueryResponse.getBody().getStateEnteredTime());
300 private InlineResponse200 createOperationQueryResponse(
301 final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum operation,
302 final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum operationState) {
303 final InlineResponse200 response = new InlineResponse200();
304 response.setId("9876");
305 response.setOperation(operation);
306 response.setOperationState(operationState);
307 response.setStartTime(JAN_1_2019_12_00);
308 response.setStateEnteredTime(JAN_1_2019_1_00);
309 response.setVnfInstanceId("myVnfInstanceId");
313 private GenericVnf createGenericVnf(final String type) {
314 final GenericVnf genericVnf = new GenericVnf();
315 genericVnf.setVnfId("myTestVnfId");
316 genericVnf.setNfType(type);
320 private void setUpGenericVnfInMockAai(final String type) {
321 final GenericVnf genericVnf = createGenericVnf(type);
323 doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class),
324 MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId")));
327 private void setUpGenericVnfWithVnfmRelationshipInMockAai(final String type, final String vnfmId) {
328 final GenericVnf genericVnf = createGenericVnf(type);
330 final Relationship relationshipToVnfm = new Relationship();
331 relationshipToVnfm.setRelatedLink(
332 "/aai/v15/external-system/esr-vnfm-li// final InlineResponse201 vnfInstance = new InlineResponse201();\n"
333 + "// vnfInstance.setInstantiationState(InstantiationStateEnum.NOT_INSTANTIATED);\n"
334 + "// mockRestServer.expect(requestTo(\"http://dummy.value/until/create/implememted/vnfId\"))\n"
335 + "// .andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));st/esr-vnfm/"
337 relationshipToVnfm.setRelatedTo("esr-vnfm");
338 final RelationshipData relationshipData = new RelationshipData();
339 relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
340 relationshipData.setRelationshipValue(vnfmId);
341 relationshipToVnfm.getRelationshipData().add(relationshipData);
343 final RelationshipList relationshipList = new RelationshipList();
344 relationshipList.getRelationship().add(relationshipToVnfm);
345 genericVnf.setRelationshipList(relationshipList);
347 doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class),
348 MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId")));
351 private void setUpVnfmsInMockAai() {
352 final EsrSystemInfo esrSystemInfo1 = new EsrSystemInfo();
353 esrSystemInfo1.setServiceUrl("http://vnfm1:8080");
354 esrSystemInfo1.setType("vnfmType1");
355 esrSystemInfo1.setSystemType("VNFM");
356 final EsrSystemInfoList esrSystemInfoList1 = new EsrSystemInfoList();
357 esrSystemInfoList1.getEsrSystemInfo().add(esrSystemInfo1);
359 final EsrVnfm esrVnfm1 = new EsrVnfm();
360 esrVnfm1.setVnfmId("vnfm1");
361 esrVnfm1.setEsrSystemInfoList(esrSystemInfoList1);
362 esrVnfm1.setResourceVersion("1234");
364 final EsrSystemInfo esrSystemInfo2 = new EsrSystemInfo();
365 esrSystemInfo2.setServiceUrl("http://vnfm2:8080");
366 esrSystemInfo2.setType("vnfmType2");
367 esrSystemInfo2.setSystemType("VNFM");
368 final EsrSystemInfoList esrSystemInfoList2 = new EsrSystemInfoList();
369 esrSystemInfoList2.getEsrSystemInfo().add(esrSystemInfo2);
371 final EsrVnfm esrVnfm2 = new EsrVnfm();
372 esrVnfm2.setVnfmId("vnfm2");
373 esrVnfm2.setEsrSystemInfoList(esrSystemInfoList2);
374 esrVnfm2.setResourceVersion("1234");
376 final EsrVnfmList esrVnfmList = new EsrVnfmList();
377 esrVnfmList.getEsrVnfm().add(esrVnfm1);
378 esrVnfmList.getEsrVnfm().add(esrVnfm2);
380 doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
381 MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
383 doReturn(Optional.of(esrSystemInfoList1)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
384 MockitoHamcrest.argThat(new AaiResourceUriMatcher(
385 "/external-system/esr-vnfm-list/esr-vnfm/vnfm1/esr-system-info-list")));
386 doReturn(Optional.of(esrSystemInfoList2)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
387 MockitoHamcrest.argThat(new AaiResourceUriMatcher(
388 "/external-system/esr-vnfm-list/esr-vnfm/vnfm2/esr-system-info-list")));
391 private void setUpVimInMockAai() {
392 final EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
393 esrSystemInfo.setServiceUrl("http://myVim:8080");
394 esrSystemInfo.setType("openstack");
395 esrSystemInfo.setSystemType("VIM");
396 esrSystemInfo.setCloudDomain("myDomain");
397 esrSystemInfo.setUserName("myUser");
398 esrSystemInfo.setPassword("myPassword");
400 final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
401 esrSystemInfoList.getEsrSystemInfo().add(esrSystemInfo);
403 doReturn(Optional.of(esrSystemInfoList)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
404 MockitoHamcrest.argThat(new AaiResourceUriMatcher("/cloud-infrastructure/cloud-regions/cloud-region/"
405 + CLOUD_OWNER + "/" + REGION + "/esr-system-info-list")));
408 private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
410 final String uriAsString;
412 public AaiResourceUriMatcher(final String uriAsString) {
413 this.uriAsString = uriAsString;
417 public boolean matches(final Object item) {
418 if (item instanceof AAIResourceUri) {
419 if (uriAsString.endsWith("...")) {
420 return ((AAIResourceUri) item).build().toString()
421 .startsWith(uriAsString.substring(0, uriAsString.indexOf("...")));
423 return ((AAIResourceUri) item).build().toString().equals(uriAsString);
429 public void describeTo(final Description description) {}