summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java44
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/scripts/AdministrationScriptsTest.java12
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java4
-rw-r--r--vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts23
-rw-r--r--vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts25
5 files changed, 71 insertions, 37 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java b/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java
index f4692c564..645b5eac0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java
@@ -8,9 +8,9 @@
* 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.
@@ -29,6 +29,7 @@ import static com.xebialabs.restito.semantics.Action.stringContent;
import static org.apache.http.client.config.RequestConfig.custom;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.testng.Assert.assertEquals;
@@ -41,18 +42,25 @@ import com.xebialabs.restito.semantics.Condition;
import com.xebialabs.restito.server.StubServer;
import io.joshworks.restclient.http.HttpResponse;
import io.joshworks.restclient.http.JsonNode;
+
+import java.io.IOException;
import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
import java.util.Collections;
+import java.util.Enumeration;
import javax.net.ssl.SSLContext;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.ssl.SSLContextBuilder;
+
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.ssl.SSLContextBuilder;
import org.glassfish.grizzly.http.Method;
import org.onap.vid.utils.Logging;
import org.springframework.http.HttpMethod;
@@ -71,7 +79,7 @@ public class SyncRestClientForHttpsServerTest {
private Logging mockLoggingService;
@BeforeMethod
- public void setUp() throws GeneralSecurityException {
+ public void setUp() throws GeneralSecurityException{
stubServer = new StubServer();
stubServer.secured().run();
mockLoggingService = mock(Logging.class);
@@ -132,12 +140,16 @@ public class SyncRestClientForHttpsServerTest {
.then(ok(), jsonContent(), contentType("application/json"));
}
- private CloseableHttpClient createNaiveHttpClient() throws GeneralSecurityException {
- final SSLContext context = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy())
- .build();
+ private CloseableHttpClient createNaiveHttpClient() throws GeneralSecurityException{
+ KeyStore mock = getMockedKeyStore();
+
+ final SSLContext context = SSLContextBuilder
+ .create()
+ .loadTrustMaterial(mock, new TrustSelfSignedStrategy())
+ .build();
final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(context, SUPPORTED_PROTOCOLS,
- null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+ null, NoopHostnameVerifier.INSTANCE);
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("https", socketFactory)
.build();
@@ -148,4 +160,20 @@ public class SyncRestClientForHttpsServerTest {
.setSSLSocketFactory(socketFactory).build();
}
+ private KeyStore getMockedKeyStore() throws KeyStoreException {
+ KeyStore mock = mock(KeyStore.class);
+ doReturn(new Enumeration<String>() {
+
+ @Override
+ public boolean hasMoreElements() {
+ return false;
+ }
+
+ @Override
+ public String nextElement() {
+ return null;
+ }
+ }).when(mock).aliases();
+ return mock;
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/scripts/AdministrationScriptsTest.java b/vid-app-common/src/test/java/org/onap/vid/scripts/AdministrationScriptsTest.java
index ddd28fd82..31dcea0f8 100644
--- a/vid-app-common/src/test/java/org/onap/vid/scripts/AdministrationScriptsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/scripts/AdministrationScriptsTest.java
@@ -56,6 +56,11 @@ public class AdministrationScriptsTest {
@Test
public void categoryParameterSh_addReleaseCategory_PostAsExpected() throws Exception {
+ if (localWgetNotCompatible()) {
+ // cannot perform the test on hosting machine
+ return;
+ }
+
final StubServer stubServer = new StubServer();
final URI scriptSource = AdministrationScriptsTest.class
.getResource("/scripts/category_parameter.sh").toURI();
@@ -100,6 +105,13 @@ public class AdministrationScriptsTest {
}
}
+ private boolean localWgetNotCompatible() throws IOException, InterruptedException {
+ // we need versions > 1.14
+ Pair<Integer, String> wgetVersion = exec("wget --version");
+ return wgetVersion.getLeft() != 0 ||
+ Pattern.compile(".*GNU Wget 1.1[0-4].*", Pattern.DOTALL).matcher(wgetVersion.getRight()).matches();
+ }
+
private Path createTempFile(String text) throws IOException {
Path input = Files.createTempFile("input", ".txt");
return Files.write(input, ImmutableList.of(text));
diff --git a/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java b/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java
index 073db0999..bfe922209 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java
@@ -54,7 +54,7 @@ public class ViewEditWithDrawingBoardTest extends VidBaseTestCase {
private String serviceType = "TYLER SILVIA";
private String serviceInstanceToResumeName;
- @FeatureTogglingTest({Features.FLAG_1902_VNF_GROUPING, Features.FLAG_FLASH_REPLACE_VF_MODULE})
+ @FeatureTogglingTest({Features.FLAG_1902_VNF_GROUPING})
@Test
public void testDeleteVnfGroupWithMembers() {
@@ -184,7 +184,7 @@ public class ViewEditWithDrawingBoardTest extends VidBaseTestCase {
);
}
- @FeatureTogglingTest({Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT, Features.FLAG_1908_RESUME_MACRO_SERVICE, Features.FLAG_FLASH_REPLACE_VF_MODULE})
+ @FeatureTogglingTest({Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT, Features.FLAG_1908_RESUME_MACRO_SERVICE})
@Test
public void testResumeServiceInstanceWithCollectionResource() {
diff --git a/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts b/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts
index d2f76e4f6..540e02fe6 100644
--- a/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts
+++ b/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts
@@ -1,6 +1,6 @@
import {ActivatedRouteSnapshot, Resolve} from "@angular/router";
import {Injectable} from "@angular/core";
-import {from, Observable} from "rxjs";
+import {from, Observable, of} from "rxjs";
import {AaiService} from "../../services/aaiService/aai.service";
import {forkJoin} from "rxjs/observable/forkJoin";
import {AppState} from "../../store/reducers";
@@ -9,11 +9,14 @@ import {createServiceInstance} from "../../storeUtil/utils/service/service.actio
import {ServiceInstance} from "../../models/serviceInstance";
import * as _ from "lodash";
import {ModelInfo} from "../../models/modelInfo";
+import {FeatureFlagsService, Features} from "../../services/featureFlag/feature-flags.service";
@Injectable()
export class ViewEditResolver implements Resolve<Observable<boolean>> {
- constructor(private _aaiService: AaiService, private _store: NgRedux<AppState>) {
+ constructor(private _aaiService: AaiService,
+ private featureFlagsService:FeatureFlagsService,
+ private _store: NgRedux<AppState>) {
}
resolve(route: ActivatedRouteSnapshot): Observable<boolean> {
@@ -26,12 +29,16 @@ export class ViewEditResolver implements Resolve<Observable<boolean>> {
let streams: Observable<any>[] = [serviceModelApi, serviceInstanceApi];
streams = streams.filter( stream => stream !== undefined);
return forkJoin(streams).switchMap(([serviceModel, serviceInstance]) => {
- return from(this.retrieveLatestVersionAndSetServiceInstance(serviceInstance.modelInfo.modelInvariantId).then((response)=>{
- this.setServiceLatestAvailableVersion(serviceInstance, response);
- this.applyRequestsResponsesToStateAndInitServiceInstance(serviceModelId, serviceInstance, serviceModel);
- return true;
- }));
-
+ if (this.featureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE)) {
+ return from(this.retrieveLatestVersionAndSetServiceInstance(serviceInstance.modelInfo.modelInvariantId).then((response) => {
+ this.setServiceLatestAvailableVersion(serviceInstance, response);
+ this.applyRequestsResponsesToStateAndInitServiceInstance(serviceModelId, serviceInstance, serviceModel);
+ return true;
+ }));
+ }
+ else {
+ return of(true);
+ }
});
}
diff --git a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
index d421fe8e1..1cc5593f7 100644
--- a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
+++ b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
@@ -4,7 +4,7 @@ import {Injectable} from '@angular/core';
import * as _ from 'lodash';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
-import {of} from "rxjs";
+import {Observable, of} from "rxjs";
import {AicZone} from "../../models/aicZone";
import {CategoryParams} from "../../models/categoryParams";
@@ -29,22 +29,12 @@ import {VnfInstance} from "../../models/vnfInstance";
import {VfModuleInstance} from "../../models/vfModuleInstance";
import {ServiceInstance} from "../../models/serviceInstance";
import {VfModuleMap} from "../../models/vfModulesMap";
-import {
- updateAicZones,
- updateCategoryParameters,
- updateLcpRegionsAndTenants,
- updateServiceTypes,
- updateSubscribers,
- updateUserId
-} from "../../storeUtil/utils/general/general.actions";
-import {
- updateModel,
- createServiceInstance,
-} from "../../storeUtil/utils/service/service.actions";
+import {updateAicZones, updateCategoryParameters, updateLcpRegionsAndTenants, updateServiceTypes, updateSubscribers, updateUserId} from "../../storeUtil/utils/general/general.actions";
+import {createServiceInstance, updateModel,} from "../../storeUtil/utils/service/service.actions";
import {FeatureFlagsService, Features} from "../featureFlag/feature-flags.service";
import {VnfMember} from "../../models/VnfMember";
import {setOptionalMembersVnfGroupInstance} from "../../storeUtil/utils/vnfGroup/vnfGroup.actions";
-import {Observable} from "rxjs";import {NetworkModalRow} from "../../../drawingBoard/service-planning/objectsToTree/models/vrf/vrfModal/networkStep/network.step.model";
+import {NetworkModalRow} from "../../../drawingBoard/service-planning/objectsToTree/models/vrf/vrfModal/networkStep/network.step.model";
import {VPNModalRow} from "../../../drawingBoard/service-planning/objectsToTree/models/vrf/vrfModal/vpnStep/vpn.step.model";
import {ModelInfo} from "../../models/modelInfo";
@@ -66,11 +56,8 @@ export class AaiService {
};
retrieveServiceLatestUpdateableVersion = (modelInvariantId: string): Observable<ModelInfo> => {
- if (this.featureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE)){
- let pathQuery: string = Constants.Path.SERVICE_LATEST_VERSION + modelInvariantId;
- return this.http.get<ModelInfo>(pathQuery)
- }
- return;
+ let pathQuery: string = Constants.Path.SERVICE_LATEST_VERSION + modelInvariantId;
+ return this.http.get<ModelInfo>(pathQuery)
};
getUserId = (): Observable<any> => {