import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMethod.DELETE;
import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMethod.GET;
import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMethod.PUT;
+import static org.springframework.web.util.UriUtils.encodeFragment;
import com.google.gson.JsonObject;
import io.vavr.collection.HashMap;
}
private String buildUri(String path) {
- return config.getAaiClientConfiguration().pnfUrl().replace(PNF_URI, path);
+ return config.getAaiClientConfiguration().pnfUrl().replace(PNF_URI, encodeFragment(path, UTF_8));
}
}
private static final String PNF_WITH_LINK_JSON = "BbsActionsTaskTestFiles/pnfWithLogicalLink.json";
private static final String LOGICAL_LINK_JSON = "BbsActionsTaskTestFiles/oldLogicalLink.json";
private static final String LOGICAL_LINK_BODY = "BbsActionsTaskTestFiles/logicalLinkBody.json";
+ private static final String LOGICAL_LINK_BODY_WITH_SPACE = "BbsActionsTaskTestFiles/logicalLinkBodyWithSpace.json";
private CbsConfiguration cbsConfiguration = mock(CbsConfiguration.class);
given(cbsConfiguration.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
JsonObject additionalFields = new JsonObject();
- String linkName = "some-link";
+ String linkName = "some link";
+ String encodedLinkName = "some%20link";
additionalFields.addProperty(ATTACHMENT_POINT, linkName);
ConsumerDmaapModel consumerDmaapModel = buildConsumerDmaapModel(additionalFields);
assertEquals(AAI_URL + PNF_URL + "/Nokia123", pnfGet.url());
assertEquals(GET, pnfGet.method());
- assertEquals(AAI_URL + LOGICAL_LINK_URL + "/" + linkName, linkPut.url());
+ assertEquals(AAI_URL + LOGICAL_LINK_URL + "/" + encodedLinkName, linkPut.url());
assertEquals(PUT, linkPut.method());
- assertEquals(getBodyJson(LOGICAL_LINK_BODY), extractBodyFromRequest(linkPut));
+ assertEquals(getBodyJson(LOGICAL_LINK_BODY_WITH_SPACE), extractBodyFromRequest(linkPut));
}
@Test