aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/services
diff options
context:
space:
mode:
authorgolabek <tomasz.golabek@nokia.com>2018-08-29 15:29:56 +0200
committergolabek <tomasz.golabek@nokia.com>2018-11-15 10:43:56 +0100
commit34f18a178b4b38632f435e776e15ce2f79d58094 (patch)
tree7bb78584134cbbe35f2db7f0f30ee0cd9ca7065b /vid-app-common/src/test/java/org/onap/vid/services
parentf4766e0a53cb3e8408d56aaa113e6350024566b3 (diff)
Get subscribers rewritten to new rest client
Should be merged after: I561f8a5d95ec35fdddc648b24965dd9dac03c9a4 It contains cherry-picked changes from that review Change-Id: I22a9e9ce709ae4dd3abcf7a9cda6354a4f656b00 Issue-ID: VID-269 Signed-off-by: golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/services')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java24
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java43
2 files changed, 59 insertions, 8 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
index ae6c2ccc..70a454a7 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
@@ -1,5 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.vid.services;
+import io.joshworks.restclient.http.HttpResponse;
import java.util.Collection;
import java.util.List;
@@ -55,7 +77,7 @@ public class AaiServiceImplTest {
@Test
public void testGetFullSubscriberList_1() throws Exception {
AaiServiceImpl testSubject;
- AaiResponse<SubscriberList> result;
+ HttpResponse<SubscriberList> result;
// default test
try {
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
index c3d01283..7ad49a96 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
@@ -1,8 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.vid.services;
import com.google.common.collect.ImmutableMap;
+import io.joshworks.restclient.http.HttpResponse;
+import java.io.UnsupportedEncodingException;
import jersey.repackaged.com.google.common.collect.ImmutableList;
-import org.onap.vid.aai.AaiClientInterface;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpVersion;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.message.BasicStatusLine;
+import org.onap.vid.aai.AaiOverTLSClientInterface;
import org.onap.vid.aai.AaiResponse;
import org.onap.vid.aai.model.AaiNodeQueryResponse;
import org.onap.vid.aai.model.ResourceType;
@@ -13,8 +41,6 @@ import org.onap.vid.model.serviceInstantiation.VfModule;
import org.onap.vid.model.serviceInstantiation.Vnf;
import org.onap.vid.mso.RestObject;
import org.onap.vid.mso.rest.AsyncRequestStatus;
-import org.onap.vid.services.AsyncInstantiationBusinessLogic;
-import org.onap.vid.services.AsyncInstantiationBusinessLogicTest;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.togglz.core.manager.FeatureManager;
@@ -48,7 +74,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
protected FeatureManager featureManager;
@Inject
- protected AaiClientInterface aaiClient;
+ protected AaiOverTLSClientInterface aaiClient;
public ServiceInstantiation generateMockServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure) {
ModelInfo modelInfo = createModelInfo();
@@ -174,12 +200,15 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
return restObject;
}
- protected void mockAaiClientAnyNameFree() {
+ protected void mockAaiClientAnyNameFree() throws UnsupportedEncodingException {
when(aaiClient.searchNodeTypeByName(any(), any())).thenReturn(aaiNodeQueryResponseNameFree());
}
- protected AaiResponse<AaiNodeQueryResponse> aaiNodeQueryResponseNameFree() {
- return new AaiResponse<>(new AaiNodeQueryResponse(null),"", 200);
+ protected HttpResponse<AaiNodeQueryResponse> aaiNodeQueryResponseNameFree() throws UnsupportedEncodingException {
+ org.apache.http.HttpResponse response = new DefaultHttpResponseFactory().newHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, null), null);
+ response.setEntity(new StringEntity(""));
+
+ return HttpResponse.fallback(new AaiNodeQueryResponse(null));
}
protected AaiResponse<AaiNodeQueryResponse> aaiNodeQueryBadResponse() {