diff options
48 files changed, 485 insertions, 221 deletions
diff --git a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java index ca317dde2..2c6fcea9d 100644 --- a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java +++ b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java @@ -59,6 +59,12 @@ public class ExternalAppInitializer extends AppInitializer { public void onStartup(ServletContext servletContext) throws ServletException { super.onStartup(servletContext); setDefaultTimeZoneToUTC(); + setPartnerName(); + } + + private void setPartnerName() { + //org.onap.logging.filter.base.AbstractMetricLogFilter read this system property + System.setProperty("partnerName", "VID.VID"); } //set time zone to UTC so Dates would be written to DB in UTC timezone diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java index 96be59123..9efb3893a 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java @@ -29,8 +29,6 @@ import static org.onap.vid.client.SyncRestClientInterface.HEADERS.AUTHORIZATION; import static org.onap.vid.client.SyncRestClientInterface.HEADERS.CONTENT_TYPE; import static org.onap.vid.client.SyncRestClientInterface.HEADERS.X_ECOMP_INSTANCE_ID; import static org.onap.vid.client.UnirestPatchKt.extractRawAsString; -import static org.onap.vid.logging.Headers.PARTNER_NAME; -import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY; import com.att.eelf.configuration.EELFLogger; import com.google.common.collect.ImmutableMap; @@ -153,9 +151,7 @@ public class SdcRestClient implements AsdcClient { private Map<String, String> prepareHeaders(String auth, String contentType) { return ImmutableMap.of( X_ECOMP_INSTANCE_ID, SystemProperties.getProperty(APP_DISPLAY_NAME), - PARTNER_NAME.getHeaderName(), PARTNER_NAME.getHeaderValue(), AUTHORIZATION, auth, - REQUEST_ID_HEADER_KEY, Logging.extractOrGenerateRequestId(), CONTENT_TYPE, contentType ); } diff --git a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java index 5c65c8af4..0883b3084 100644 --- a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java +++ b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java @@ -49,10 +49,13 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLContexts; 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.client.HttpClients; import org.eclipse.jetty.util.security.Password; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.vid.logging.ApacheClientMetricRequestInterceptor; +import org.onap.vid.logging.ApacheClientMetricResponseInterceptor; import org.onap.vid.properties.VidProperties; import org.onap.vid.utils.Logging; import org.springframework.http.HttpMethod; @@ -68,22 +71,29 @@ public class SyncRestClient implements SyncRestClientInterface { private RestClient restClient; public SyncRestClient(Logging loggingService) { - this(null, null, loggingService); + this(null, null, loggingService, false); + } + + public SyncRestClient(Logging loggingService, boolean useLoggingInterceptor) { + this(null, null, loggingService, useLoggingInterceptor); } public SyncRestClient(ObjectMapper objectMapper, Logging loggingService) { - this(null, objectMapper, loggingService); + this(null, objectMapper, loggingService, false); } public SyncRestClient(CloseableHttpClient httpClient, Logging loggingService) { - this(httpClient, null, loggingService); + this(httpClient, null, loggingService, false); } - public SyncRestClient(CloseableHttpClient httpClient, ObjectMapper objectMapper, Logging loggingService) { + public SyncRestClient(CloseableHttpClient httpClient, + ObjectMapper objectMapper, + Logging loggingService, + boolean useLoggingInterceptor) { restClient = RestClient .newClient() .objectMapper(ObjectUtils.defaultIfNull(objectMapper, defaultObjectMapper())) - .httpClient(ObjectUtils.defaultIfNull(httpClient , defaultHttpClient())) + .httpClient(ObjectUtils.defaultIfNull(httpClient , defaultHttpClient(useLoggingInterceptor))) .build(); this.loggingService = loggingService; this.outgoingRequestsLogger = Logging.getRequestsLogger("syncRestClient"); @@ -253,7 +263,7 @@ public class SyncRestClient implements SyncRestClientInterface { return JOSHWORKS_JACKSON_OBJECT_MAPPER; } - private CloseableHttpClient defaultHttpClient() { + private CloseableHttpClient defaultHttpClient(boolean useLoggingInterceptor) { try { String trustStorePath = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_FILENAME); String trustStorePass = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_PASSWD_X); @@ -263,7 +273,13 @@ public class SyncRestClient implements SyncRestClientInterface { SSLContext sslContext = trustOwnCACerts(decryptedTrustStorePass, trustStore); SSLConnectionSocketFactory sslSf = allowTLSProtocols(sslContext); - return HttpClients.custom().setSSLSocketFactory(sslSf).build(); + HttpClientBuilder httpClientBuilder = HttpClients.custom().setSSLSocketFactory(sslSf); + if (useLoggingInterceptor) { + httpClientBuilder + .addInterceptorFirst(new ApacheClientMetricRequestInterceptor()) + .addInterceptorLast(new ApacheClientMetricResponseInterceptor()); + } + return httpClientBuilder.build(); } catch (IOException | CertificateException | UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { logger.warn("Cannot initialize custom http client from current configuration. Using default one.", e); return HttpClients.createDefault(); diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java b/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java index 928e19357..48677120d 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java @@ -65,7 +65,7 @@ public class LoggerController extends RestrictedBaseController { this.logfilePathCreator = logfilePathCreator; } - @GetMapping(value = "/{loggerName:audit|audit2019|error|metrics}") + @GetMapping(value = "/{loggerName:audit|audit2019|error|metrics|metrics2019}") public String getLog(@PathVariable String loggerName, HttpServletRequest request, @RequestParam(value="limit", defaultValue = "5000") Integer limit) throws IOException { diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java index 9faa7ade5..6c5595ca3 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java @@ -29,6 +29,7 @@ import java.io.File; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.servlet.ServletContext; +import org.onap.logging.filter.spring.LoggingInterceptor; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.aai.AaiClient; import org.onap.vid.aai.AaiClientInterface; @@ -68,6 +69,8 @@ import org.onap.vid.utils.Logging; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.togglz.core.manager.FeatureManager; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; @@ -77,7 +80,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 @Configuration -public class WebConfig { +public class WebConfig implements WebMvcConfigurer { /** * Gets the object mapper. @@ -160,7 +163,9 @@ public class WebConfig { String protocol = asdcClientConfiguration.getAsdcClientProtocol(); int port = asdcClientConfiguration.getAsdcClientPort(); - return new SdcRestClient(protocol + "://" + host + ":" + port + "/", auth, new SyncRestClient(loggingService), loggingService); + return new SdcRestClient(protocol + "://" + host + ":" + port + "/", auth, + new SyncRestClient( loggingService, true), + loggingService); } @Bean @@ -214,4 +219,9 @@ public class WebConfig { int threadsCount = defaultIfNull(Integer.parseInt(SystemProperties.getProperty(VidProperties.VID_THREAD_COUNT)), 1); return Executors.newFixedThreadPool(threadsCount); } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new LoggingInterceptor()); + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/logging/ApacheClientMetricRequestInterceptor.java b/vid-app-common/src/main/java/org/onap/vid/logging/ApacheClientMetricRequestInterceptor.java new file mode 100644 index 000000000..0cc5a2aaa --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/logging/ApacheClientMetricRequestInterceptor.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. 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.logging; + +import org.apache.http.HttpRequest; +import org.apache.http.HttpRequestInterceptor; +import org.apache.http.protocol.HttpContext; + +public class ApacheClientMetricRequestInterceptor extends ApacheClientMetricInterceptor implements HttpRequestInterceptor { + + @Override + public void process(HttpRequest request, HttpContext context) { + this.pre(request, request); + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/logging/ApacheClientMetricResponseInterceptor.java b/vid-app-common/src/main/java/org/onap/vid/logging/ApacheClientMetricResponseInterceptor.java new file mode 100644 index 000000000..72b54e7a5 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/logging/ApacheClientMetricResponseInterceptor.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. 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.logging; + +import org.apache.http.HttpResponse; +import org.apache.http.HttpResponseInterceptor; +import org.apache.http.protocol.HttpContext; + +public class ApacheClientMetricResponseInterceptor extends ApacheClientMetricInterceptor implements HttpResponseInterceptor { + + @Override + public void process(HttpResponse response, HttpContext context) { + this.post(null, response); + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/logging/VidLoggerAspect.java b/vid-app-common/src/main/java/org/onap/vid/logging/VidLoggerAspect.java index 309ead40c..f87297c37 100644 --- a/vid-app-common/src/main/java/org/onap/vid/logging/VidLoggerAspect.java +++ b/vid-app-common/src/main/java/org/onap/vid/logging/VidLoggerAspect.java @@ -32,6 +32,7 @@ import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.portalsdk.core.logging.aspect.EELFLoggerAdvice; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.service.AppService; @@ -39,6 +40,7 @@ import org.onap.portalsdk.core.util.SystemProperties; import org.onap.portalsdk.core.web.support.UserUtils; import org.onap.vid.controller.ControllersUtils; import org.onap.vid.utils.SystemPropertiesWrapper; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -87,9 +89,10 @@ public class VidLoggerAspect { Object[] passOnArgs = new Object[] {joinPoint.getSignature().getDeclaringType().getName(),joinPoint.getSignature().getName()}; Object[] returnArgs = advice.before(securityEventType, fabricateArgsWithNull(), passOnArgs); - fixSetRequestBasedDefaultsIntoGlobalLoggingContext(httpServletRequestOrNull(joinPoint), + HttpServletRequest httpServletRequest = httpServletRequestOrNull(joinPoint); + fixSetRequestBasedDefaultsIntoGlobalLoggingContext(httpServletRequest, joinPoint.getSignature().getDeclaringType().getName()); - + addRequestIdToMdcForMetricFilter(httpServletRequest); fixServerFqdnInMDC(); //Execute the actual method @@ -108,6 +111,14 @@ public class VidLoggerAspect { return result; } + //prepare MDC for org.onap.logging.filter.base.AbstractMetricLogFilter + private void addRequestIdToMdcForMetricFilter(HttpServletRequest httpServletRequest) { + if (httpServletRequest!=null) { + String requestId = UserUtils.getRequestId(httpServletRequest); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); + } + } + // Set the status code into MDC *before* the metrics log is written by advice.after() private void fixStatusCodeInMDC(String restStatus) { EELFLoggerDelegate.mdcPut(SystemProperties.STATUS_CODE, restStatus); @@ -155,6 +166,7 @@ public class VidLoggerAspect { String loginId = controllersUtils.extractUserId(httpServletRequest); logger.setRequestBasedDefaultsIntoGlobalLoggingContext(httpServletRequest, appName, requestId, loginId); + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java index 91b288998..0585a4736 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java @@ -20,10 +20,6 @@ package org.onap.vid.mso; -import static org.onap.vid.logging.Headers.INVOCATION_ID; -import static org.onap.vid.logging.Headers.PARTNER_NAME; -import static org.onap.vid.utils.Logging.ONAP_REQUEST_ID_HEADER_KEY; -import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY; import static org.onap.vid.utils.Logging.getMethodCallerName; import static org.onap.vid.utils.Logging.getMethodName; @@ -40,6 +36,7 @@ import javax.ws.rs.core.Response; import org.apache.commons.codec.binary.Base64; import org.eclipse.jetty.util.security.Password; import org.glassfish.jersey.client.ClientProperties; +import org.onap.logging.filter.base.MetricLogClientFilter; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.vid.aai.util.HttpClientMode; import org.onap.vid.aai.util.HttpsAuthClient; @@ -107,12 +104,8 @@ public class RestMsoImplementation { MultivaluedHashMap<String, Object> commonHeaders = new MultivaluedHashMap(); commonHeaders.put("Authorization", Collections.singletonList(("Basic " + authStringEnc))); - commonHeaders.put(PARTNER_NAME.getHeaderName(), Collections.singletonList(PARTNER_NAME.getHeaderValue())); String requestIdValue = Logging.extractOrGenerateRequestId(); - commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue)); - commonHeaders.put(ONAP_REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue)); - commonHeaders.put(INVOCATION_ID.getHeaderName(), Collections.singletonList(INVOCATION_ID.getHeaderValue())); boolean useSsl = true; if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) { @@ -121,11 +114,13 @@ public class RestMsoImplementation { if (client == null) { try { - if ( useSsl ) { - client = httpsAuthClient.getClient(HttpClientMode.WITHOUT_KEYSTORE); - } + if ( useSsl ) { + client = httpsAuthClient.getClient(HttpClientMode.WITHOUT_KEYSTORE); + registerClientToMetricLogClientFilter(client); + } else { client = HttpBasicClient.getClient(); + registerClientToMetricLogClientFilter(client); } } catch (Exception e) { logger.info(EELFLoggerDelegate.errorLogger,methodname + " Unable to get the SSL client"); @@ -135,6 +130,11 @@ public class RestMsoImplementation { return commonHeaders; } + private void registerClientToMetricLogClientFilter(Client client) { + MetricLogClientFilter metricLogClientFilter = new MetricLogClientFilter(); + client.register(metricLogClientFilter); + } + public <T> RestObject<T> GetForObject(String path, Class<T> clazz) { final String methodName = getMethodName(); logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {})", getMethodCallerName(), methodName, path, clazz); diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java index 7cbf0805b..c2bf27fba 100644 --- a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java @@ -24,18 +24,13 @@ import static com.xebialabs.restito.semantics.Action.ok; import static com.xebialabs.restito.semantics.Action.stringContent; import static org.apache.http.client.config.RequestConfig.custom; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.equalToIgnoringCase; import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.matchesPattern; import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.hamcrest.collection.IsMapContaining.hasEntry; import static org.hamcrest.collection.IsMapContaining.hasKey; -import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.onap.vid.client.SyncRestClientInterface.HEADERS.X_ECOMP_INSTANCE_ID; -import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY; import com.fasterxml.jackson.core.JsonProcessingException; import com.xebialabs.restito.semantics.Call; @@ -67,7 +62,6 @@ import org.onap.vid.utils.Logging; public class SdcRestClientITTest { - private static final String UUID_REGEX = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; private static final String[] SUPPORTED_SSL_VERSIONS = {"TLSv1", "TLSv1.2"}; private static StubServerUtil stubServer; private static SdcRestClient sdcRestClient; @@ -129,12 +123,7 @@ public class SdcRestClientITTest { assertTrue(first.isPresent()); - assertThat(first.get().getHeaders(), - allOf( - hasEntry(equalToIgnoringCase(REQUEST_ID_HEADER_KEY), contains(matchesPattern(UUID_REGEX))), - hasKey(equalToIgnoringCase(X_ECOMP_INSTANCE_ID)), - hasEntry(equalToIgnoringCase("x-onap-partnerName"), contains(equalTo("VID.VID"))) - )); + assertThat(first.get().getHeaders(), hasKey(equalToIgnoringCase(X_ECOMP_INSTANCE_ID))); } private Service getExpectedService(String stringId) { diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java index 792435002..2e321f93e 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java @@ -22,6 +22,7 @@ package org.onap.vid.mso; import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @@ -30,6 +31,7 @@ import static org.mockito.MockitoAnnotations.initMocks; import io.joshworks.restclient.request.HttpRequest; import java.io.IOException; import java.security.GeneralSecurityException; +import java.util.List; import java.util.Optional; import javax.ws.rs.client.Client; import javax.ws.rs.client.Entity; @@ -39,6 +41,7 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.JerseyInvocation; +import org.hamcrest.MatcherAssert; import org.mockito.InjectMocks; import org.mockito.Mock; import org.onap.vid.aai.util.HttpClientMode; @@ -99,7 +102,9 @@ public class RestMsoImplementationTest { MultivaluedHashMap<String, Object> result = restMsoImplementation.initMsoClient(); // then - assertThat(result).containsKeys("Authorization","X-ONAP-PartnerName"); + List<Object> authorizationHeaders = result.get("Authorization"); + MatcherAssert.assertThat(authorizationHeaders, hasSize(1)); + assertThat((String) authorizationHeaders.get(0)).startsWith("Basic "); assertThat(result).doesNotContainKey("notExistingKey"); } diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java index cfb9ee6ea..fd66dab52 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java @@ -151,28 +151,6 @@ public class OutgoingRequestHeadersTest { ).map(l -> ImmutableList.of(l).toArray()).collect(Collectors.toList()).toArray(new Object[][]{}); } - @Test(dataProvider = "msoMethods") - public void mso(Consumer<RestMsoImplementation> f) throws Exception { - final TestUtils.JavaxRsClientMocks mocks = setAndGetMocksInsideRestImpl(restMsoImplementation); - - f.accept(restMsoImplementation); - HeadersVerifier headersVerifier = new HeadersVerifier().verifyFirstCall(mocks.getFakeBuilder()); - - assertThat((String) captureHeaderKeyAndReturnItsValue(mocks.getFakeBuilder(), "Authorization"), startsWith("Basic ")); - - //verify requestId is same in next call but invocationId is different - - //given - final TestUtils.JavaxRsClientMocks mocks2 = setAndGetMocksInsideRestImpl(restMsoImplementation); - - //when - f.accept(restMsoImplementation); - //then - headersVerifier.verifySecondCall(mocks2.getFakeBuilder()); - } - - - @Test public void whenProvideMsoRestCallUserId_builderHasXRequestorIDHeader() throws Exception { diff --git a/vid-automation/pom.xml b/vid-automation/pom.xml index 6f2ae22c2..e2ef865f4 100644 --- a/vid-automation/pom.xml +++ b/vid-automation/pom.xml @@ -191,8 +191,8 @@ </dependency> <dependency> <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <version>1.3</version> + <artifactId>java-hamcrest</artifactId> + <version>2.0.0.0</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java index 2bc664591..1cfdd8866 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java @@ -48,6 +48,7 @@ public abstract class BaseMSOPreset extends BasePreset { public Map<String, String> getRequestHeaders() { Map<String, String> map = super.getRequestHeaders(); map.put("X-ONAP-PartnerName", "VID.VID"); + map.put("X-ECOMP-RequestID", "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}"); return map; } } diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseSDCPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseSDCPreset.java index ad8dfb3ac..ba35299a8 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseSDCPreset.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseSDCPreset.java @@ -4,15 +4,19 @@ import java.util.Map; public abstract class BaseSDCPreset extends BasePreset { + public static final String SDC_ROOT_PATH = "/sdc/v1/catalog/services"; + @Override protected String getRootPath() { - return "/sdc/v1/catalog/services"; + return SDC_ROOT_PATH; } @Override public Map<String, String> getRequestHeaders() { Map<String, String> map = super.getRequestHeaders(); map.put("X-ONAP-PartnerName", "VID.VID"); + map.put("X-ONAP-InvocationID", "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}"); + map.put("X-ONAP-RequestID", "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}"); return map; } diff --git a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java index fd7033c6e..6e15b7b52 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java +++ b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java @@ -1,5 +1,6 @@ package vid.automation.test.services; +import static java.util.stream.Collectors.toList; import static org.testng.Assert.assertEquals; import static vid.automation.test.services.DropTestApiField.dropFieldCloudOwnerFromString; import static vid.automation.test.services.DropTestApiField.dropTestApiFieldFromString; @@ -55,11 +56,24 @@ public class SimulatorApi { public List<StringWrapper> values; } - public static class HttpRequest{ + public static class HttpRequest { public StringWrapper path; public List<RecordedHeaders> headers; } + public static class RecordedRequests { + public String path; + public Map<String, List<String>> headers; + + public RecordedRequests(String path, Map<String, List<String>> headers) { + this.path = path; + this.headers = headers; + } + + public RecordedRequests() { + } + } + private static final URI uri; //uri for registration private static final URI simulationUri; //uri for getting simulated responses private static final Client client; @@ -125,7 +139,7 @@ public class SimulatorApi { public static void registerExpectationFromPresetsCollections(Collection<Collection<BasePreset>> presets, RegistrationStrategy registrationStrategy) { registerExpectationFromPresets(presets.stream() .flatMap(Collection::stream) - .collect(Collectors.toList()), registrationStrategy); + .collect(toList()), registrationStrategy); } public static void registerExpectationFromPresets(Collection<BasePreset> presets, RegistrationStrategy registrationStrategy) { @@ -152,16 +166,27 @@ public class SimulatorApi { The key of the map is a path, and the value is counter */ public static Map<String, Long> retrieveRecordedRequestsPathCounter() { - List<HttpRequest> httpRequests = retrieveRecordedRequests(); + List<HttpRequest> httpRequests = retrieveRecordedHttpRequests(); return httpRequests.stream().map(x->x.path.value).collect( Collectors.groupingBy(Function.identity(), Collectors.counting())); } - public static List<HttpRequest> retrieveRecordedRequests() { + private static List<HttpRequest> retrieveRecordedHttpRequests() { Response response = client.target(uri).path("retrieveRecordedRequests").request().get(); return response.readEntity(new GenericType<List<HttpRequest>>(){}); } + public static List<RecordedRequests> retrieveRecordedRequests() { + List<HttpRequest> rawRequests = retrieveRecordedHttpRequests(); + return rawRequests.stream().map(request->new RecordedRequests( + request.path.value, + request.headers.stream().collect( + Collectors.toMap( + x->x.name.value, + x->x.values.stream().map(y->y.value).collect(toList()))) + )).collect(toList()); + } + private static void registerToSimulatorAndAssertSuccess(String name, Object content, RegistrationStrategy registrationStrategy) { if (registrationStrategy == RegistrationStrategy.CLEAR_THEN_SET) { clearRegistrations(); diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java index 4ca01dc63..c128b864b 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java @@ -58,6 +58,7 @@ import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaMo import org.onap.vid.model.aai.AaiResponse; import org.onap.vid.model.mso.OperationalEnvironmentList; import org.onap.vid.more.LoggerFormatTest; +import org.onap.vid.more.LoggerFormatTest.LogName; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; @@ -353,7 +354,7 @@ public class AaiApiTest extends BaseApiAaiTest { SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), APPEND); restTemplateErrorAgnostic.getForEntity(uri + "/aai_get_services", String.class); - String logLines = LoggerFormatTest.getLogLines("error", 15, 0, restTemplate, uri); + String logLines = LoggerFormatTest.getLogLines(LogName.error, 15, 0, restTemplate, uri); assertThat("not found in error log", logLines, containsString("Failed to parse aai response")); assertThat("not found in error log", logLines, containsString(notAJson)); diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInfraApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInfraApiTest.java index 058cb2f5b..b3c605ced 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInfraApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInfraApiTest.java @@ -1,21 +1,21 @@ package org.onap.vid.api; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.testng.AssertJUnit.assertEquals; + import com.google.common.collect.ImmutableList; +import java.util.UUID; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; import org.onap.vid.more.LoggerFormatTest; +import org.onap.vid.more.LoggerFormatTest.LogName; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import vid.automation.test.services.SimulatorApi; -import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.testng.AssertJUnit.assertEquals; - public class AsyncInfraApiTest extends BaseApiTest { public static final String API_URL = "asyncForTests"; @@ -51,7 +51,7 @@ public class AsyncInfraApiTest extends BaseApiTest { assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, jobResult.getStatusCode()); assertThat(jobResult.getBody(), containsString("GenericUncheckedException")); assertThat(jobResult.getBody(), containsString("dummy error")); - String logLines = LoggerFormatTest.getLogLines("error", 15, 0, restTemplate, uri); + String logLines = LoggerFormatTest.getLogLines(LogName.error, 15, 0, restTemplate, uri); assertThat(logLines, containsString("GenericUncheckedException")); assertThat(logLines, containsString("dummy error")); } diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java index 04dbbc0c5..f22b6de65 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java @@ -26,6 +26,8 @@ import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; +import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseSDCPreset.SDC_ROOT_PATH; +import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; @@ -36,16 +38,18 @@ import static vid.automation.test.utils.ReadFile.loadResourceAsString; import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; +import org.onap.vid.more.LoggerFormatTest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import vid.automation.test.infra.FeatureTogglingTest; import vid.automation.test.infra.Features; +import vid.automation.test.infra.ModelInfo; public class SdcApiTest extends BaseApiTest { @@ -99,7 +103,7 @@ public class SdcApiTest extends BaseApiTest { public void getServiceModelALaCarteInstantiation() { registerToSimulatorWithPresets(A_LA_CARTE_INSTANTIATION_TYPE_UUID, A_LA_CARTE_INSTANTIATION_TYPE_INVARIANT_UUID, A_LA_CARTE_INSTANTIATION_TYPE_FILE_PATH); ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + A_LA_CARTE_INSTANTIATION_TYPE_UUID), String.class); - Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); + assertEquals(response.getStatusCode(), HttpStatus.OK); String aLaCarteInstantiationTypeExpectedResponse = loadResourceAsString(A_LA_CARTE_INSTANTIATION_TYPE_EXPECTED_RESPONSE); assertThat(response.getBody(), jsonEquals(aLaCarteInstantiationTypeExpectedResponse) .when(IGNORING_ARRAY_ORDER) @@ -111,7 +115,7 @@ public class SdcApiTest extends BaseApiTest { public void getServiceModelMacroInstantiation() { registerToSimulatorWithPresets(MACRO_INSTANTIATION_TYPE_UUID, MACRO_INSTANTIATION_TYPE_INVARIANT_UUID, MACRO_INSTANTIATION_TYPE_FILE_PATH); ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MACRO_INSTANTIATION_TYPE_UUID), String.class); - Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); + assertEquals(response.getStatusCode(), HttpStatus.OK); String macroInstantiationTypeExpectedResponse = loadResourceAsString(MACRO_INSTANTIATION_TYPE_EXPECTED_RESPONSE); assertThat(response.getBody(), jsonEquals(macroInstantiationTypeExpectedResponse) .when(IGNORING_ARRAY_ORDER) @@ -123,7 +127,7 @@ public class SdcApiTest extends BaseApiTest { public void getServiceModelWithoutInstantiationType(){ registerToSimulatorWithPresets(MACRO_INSTANTIATION_TYPE_UUID, MACRO_INSTANTIATION_TYPE_INVARIANT_UUID, EMPTY_INSTANTIATION_TYPE_FILE_PATH); ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MACRO_INSTANTIATION_TYPE_UUID), String.class); - Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); + assertEquals(response.getStatusCode(), HttpStatus.OK); String emptyInstantiationTypeExpectedResponse = loadResourceAsString(EMPTY_INSTANTIATION_TYPE_EXPECTED_RESPONSE); assertThat("The response is in the format of JSON", response.getBody(), is(jsonStringEquals(turnOffInstantiationUI(emptyInstantiationTypeExpectedResponse)))); } @@ -132,7 +136,7 @@ public class SdcApiTest extends BaseApiTest { public void getServiceModelBothInstantiationType(){ registerToSimulatorWithPresets(MACRO_INSTANTIATION_TYPE_UUID, MACRO_INSTANTIATION_TYPE_INVARIANT_UUID, BOTH_INSTANTIATION_TYPE_FILE_PATH); ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MACRO_INSTANTIATION_TYPE_UUID), String.class); - Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); + assertEquals(response.getStatusCode(), HttpStatus.OK); String macroInstantiationTypeExpectedResponse = loadResourceAsString(MACRO_INSTANTIATION_TYPE_EXPECTED_RESPONSE); assertThat(response.getBody(), jsonEquals(macroInstantiationTypeExpectedResponse) .when(IGNORING_ARRAY_ORDER) @@ -143,7 +147,7 @@ public class SdcApiTest extends BaseApiTest { public void getServiceModelWithGroupsAndCheckMinMaxInitialParams(){ registerToSimulatorWithPresets(MIN_MAX_INITIAL_UUID, MIN_MAX_INITIAL_INVARIANT_UUID, MIN_MAX_INITIAL_FILE_PATH); ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MIN_MAX_INITIAL_UUID), String.class); - Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); + assertEquals(response.getStatusCode(), HttpStatus.OK); String minMaxInitialExpectedResponse = loadResourceAsString("sdcApiTest/minMaxInitialExpectedResponse.json"); assertThat("The response is in the format of JSON", response.getBody(), is(jsonStringEquals(turnOffInstantiationUI(minMaxInitialExpectedResponse)))); } @@ -152,7 +156,7 @@ public class SdcApiTest extends BaseApiTest { public void getServiceModelWithGroupsAndCheckMinMaxInitialParamsOldCsar(){ registerToSimulatorWithPresets(MIN_MAX_INITIAL_UUID_OLD_CSAR, MIN_MAX_INITIAL_INVARIANT_UUID_OLD_CSAR, MIN_MAX_INITIAL_FILE_PATH_OLD_CSAR); ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MIN_MAX_INITIAL_UUID_OLD_CSAR), String.class); - Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); + assertEquals(response.getStatusCode(), HttpStatus.OK); String minMaxInitialExpectedResponseOldCsar = loadResourceAsString("sdcApiTest/minMaxInitialExpectedResponseOldCsar.json"); assertThat("The response is in the format of JSON", response.getBody(), is(jsonStringEquals(minMaxInitialExpectedResponseOldCsar))); } @@ -162,7 +166,7 @@ public class SdcApiTest extends BaseApiTest { public void getServiceModelWithServiceRoleGrouping(){ registerToSimulatorWithPresets(GROUPING_SERVICE_ROLE_UUID, GROUPING_SERVICE_ROLE_INVARIANT_UUID, GROUPING_SERVICE_ROLE_FILE_PATH); ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + GROUPING_SERVICE_ROLE_UUID), String.class); - Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); + assertEquals(response.getStatusCode(), HttpStatus.OK); String groupingServiceRoleExpectedResponse = loadResourceAsString(GROUPING_SERVICE_ROLE_EXPECTED_RESPONSE); assertThat("The response is in the format of JSON", response.getBody(), is(jsonStringEquals(groupingServiceRoleExpectedResponse))); } @@ -211,4 +215,24 @@ public class SdcApiTest extends BaseApiTest { response.at(base + "/volumeGroups").size(), is(not(0))); } + + @Test + public void whenCallSdc_thenRequestRecordedInMetricsLog() { + + ModelInfo modelInfo = ModelInfo.transportWithPnfsService; + + registerExpectationFromPresets(ImmutableList.of( + new PresetSDCGetServiceToscaModelGet(modelInfo), + new PresetSDCGetServiceMetadataGet(modelInfo), + new PresetAAIGetSubscribersGet() //for read logs permissions + ), CLEAR_THEN_SET); + + ResponseEntity<String> response = restTemplate.getForEntity( + buildUri(SDC_GET_SERVICE_MODEL + modelInfo.modelVersionId), String.class); + + final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo"); + + LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId, SDC_ROOT_PATH, 2); + } + } diff --git a/vid-automation/src/test/java/org/onap/vid/more/AuditLoggerTest.java b/vid-automation/src/test/java/org/onap/vid/more/AuditLoggerTest.java new file mode 100644 index 000000000..b27d6a8af --- /dev/null +++ b/vid-automation/src/test/java/org/onap/vid/more/AuditLoggerTest.java @@ -0,0 +1,65 @@ +package org.onap.vid.more; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.equalToIgnoringCase; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.collection.IsMapContaining.hasKey; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; + +import java.util.List; +import java.util.function.Supplier; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetVpnsByType; +import org.onap.vid.api.BaseApiTest; +import org.onap.vid.more.LoggerFormatTest.LogName; +import org.springframework.http.ResponseEntity; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import vid.automation.test.services.SimulatorApi; + +public class AuditLoggerTest extends BaseApiTest { + + private final String ECOMP_REQUEST_ID_ECHO = "x-ecomp-requestid-echo"; + + @BeforeClass + public void login() { + super.login(); + } + + @BeforeMethod + public void resetPreset() { + SimulatorApi.registerExpectation("create_new_instance/aai_get_full_subscribers.json", CLEAR_THEN_SET); + } + + @Test + public void aaiController2$GetVpnList_requestIdIsAuditedInEntryAndInExit() { + registerExpectationFromPreset(new PresetAAIGetVpnsByType(), APPEND); + String requestId = getRequestId(() -> restTemplate.getForEntity(buildUri("aai_get_vpn_list"), String.class)); + + assertThat("request id must be found in exactly two rows", getRequestLogLines(requestId), + contains( + allOf(containsString(requestId), containsString("Entering")), + allOf(containsString(requestId), containsString("Exiting")) + )); + } + + private List<String> getRequestLogLines(String requestId) { + return LoggerFormatTest.getRequestLogLines(requestId, LogName.audit2019, restTemplate, uri); + } + + private String getRequestId(Supplier<ResponseEntity<?>> request) { + ResponseEntity<?> response = request.get(); + + assertThat(response.getHeaders(), hasKey(equalToIgnoringCase(ECOMP_REQUEST_ID_ECHO))); + List<String> requestIds = response.getHeaders().get(ECOMP_REQUEST_ID_ECHO); + + assertThat(requestIds, hasSize(1)); + return requestIds.get(0); + } + +} diff --git a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java index e01ffe8b4..6a4bf950f 100644 --- a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java +++ b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java @@ -1,12 +1,23 @@ package org.onap.vid.more; +import static java.util.Collections.reverse; +import static java.util.stream.Collectors.toList; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInRelativeOrder; import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.hasSize; +import static vid.automation.test.services.SimulatorApi.retrieveRecordedRequests; import com.fasterxml.jackson.databind.JsonNode; import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -18,12 +29,17 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import vid.automation.test.infra.SkipTestUntil; import vid.automation.test.services.SimulatorApi; +import vid.automation.test.services.SimulatorApi.RecordedRequests; public class LoggerFormatTest extends BaseApiTest { private final static String logChecker = System.getProperty("EELF_LOG_CHECKER", "http://my-logchecker:8888/validate"); private final Logger logger = LogManager.getLogger(LoggerFormatTest.class); + public enum LogName { + audit, error, audit2019, metrics2019, metrics + } + @BeforeClass public void login() { super.login(); @@ -37,34 +53,34 @@ public class LoggerFormatTest extends BaseApiTest { @SkipTestUntil("2019-09-24") @Test public void validateAuditLogsFormat() { - validateLogsFormat("audit"); + validateLogsFormat(LogName.audit); } @Test public void validateAudit2019LogsFormat() { - validateLogsFormat("audit2019", "audit-ELS-2019.11", 0); + validateLogsFormat(LogName.audit2019, "audit-ELS-2019.11", 0); } @Test(enabled = false) // no total-score is returned for error-log public void validateErrorLogsFormat() { - validateLogsFormat("error"); + validateLogsFormat(LogName.error); } @SkipTestUntil("2019-09-24") @Test public void validateMetricsLogsFormat() { - validateLogsFormat("metrics", "metric"); + validateLogsFormat(LogName.metrics, "metric"); } - private void validateLogsFormat(String logName) { - validateLogsFormat(logName, logName); + private void validateLogsFormat(LogName logName) { + validateLogsFormat(logName, logName.name()); } - private void validateLogsFormat(String logName, String logType) { + private void validateLogsFormat(LogName logName, String logType) { validateLogsFormat(logName, logType, 0.95); } - private void validateLogsFormat(String logName, String logType, double score) { + private void validateLogsFormat(LogName logName, String logType, double score) { String logLines = getLogLines(logName); logger.info("logLines are: "+logLines); @@ -78,18 +94,73 @@ public class LoggerFormatTest extends BaseApiTest { } - private String getLogLines(String logname) { + private String getLogLines(LogName logname) { return getLogLines(logname, 5000, 30, restTemplate, uri); } - public static String getLogLines(String logname, int maxRows, int minRows, RestTemplate restTemplate, URI uri) { - String logLines = restTemplate.getForObject(uri + "/logger/" + logname + "?limit={maxRows}", String.class, maxRows); - assertThat("expecting at least " + minRows + " rows in " + logname, + public static String getLogLines(LogName logname, int maxRows, int minRows, RestTemplate restTemplate, URI uri) { + String logLines = restTemplate.getForObject(uri + "/logger/" + logname.name() + "?limit={maxRows}", String.class, maxRows); + assertThat("expecting at least " + minRows + " rows in " + logname.name(), StringUtils.countMatches(logLines, '\n') + 1, is(greaterThanOrEqualTo(minRows))); return logLines; } + /** + * @return Chronological-ordered list of recent log-lines of a given requestId + */ + public static List<String> getRequestLogLines(String requestId, LogName logname, RestTemplate restTemplate, URI uri) { + String logLines = LoggerFormatTest.getLogLines(logname, 30, 1, restTemplate, uri); + + // Split + List<String> lines = new ArrayList<>(Arrays.asList(logLines.split("(\\r?\\n)"))); + + // Filter + lines.removeIf(line -> !StringUtils.containsIgnoreCase(line, requestId)); + + // Reverse + reverse(lines); + + return lines; + } + + public static void assertHeadersAndMetricLogs(RestTemplate restTemplate, URI uri, String requestId, String path, int requestsSize) { + List<String> logLines = + getRequestLogLines(requestId, LogName.metrics2019, restTemplate, uri); + + List<RecordedRequests> requests = retrieveRecordedRequests(); + List<RecordedRequests> underTestRequests = + requests.stream().filter(x->x.path.startsWith(path)).collect(toList()); + + assertThat(underTestRequests, hasSize(requestsSize)); + + underTestRequests.forEach(request-> { + assertThat("X-ONAP-RequestID", request.headers.get("X-ONAP-RequestID"), contains(requestId)); + assertThat("X-ECOMP-RequestID", request.headers.get("X-ECOMP-RequestID"), contains(requestId)); + assertThat("X-ONAP-PartnerName", request.headers.get("X-ONAP-PartnerName"), contains("VID.VID")); + }); + + underTestRequests.forEach(request->{ + + List<String> invocationIds = request.headers.get("X-ONAP-InvocationID"); + assertThat(invocationIds, hasSize(1)); + + String invocationId = invocationIds.get(0); + assertThat("request id and invocation id must be found in exactly two rows", + logLines, + containsInRelativeOrder( + allOf( + containsString("RequestID="+requestId), + containsString("InvocationID="+ invocationId), + containsString("Invoke")), + allOf( + containsString("RequestID="+requestId), + containsString("InvocationID="+ invocationId), + containsString("InvokeReturn")) + )); + }); + } + private JsonNode getCheckerResults(String logtype, String logLines) { Map<String, String> params = new HashMap<>(); params.put("format", "raw"); diff --git a/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java b/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java index fb710b324..07bd3b0dc 100644 --- a/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java +++ b/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java @@ -9,7 +9,6 @@ import static org.onap.vid.api.pProbeMsoApiTest.MSO_CREATE_CONFIGURATION; import static org.springframework.http.HttpHeaders.AUTHORIZATION; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import java.util.List; import java.util.UUID; @@ -21,6 +20,7 @@ import org.onap.simulator.presetGenerator.presets.aaf.AAFGetUrlServicePreset; import org.onap.vid.api.BaseApiTest; import org.onap.vid.api.OperationalEnvironmentControllerApiTest; import org.onap.vid.api.ServiceInstanceMsoApiTest; +import org.onap.vid.more.LoggerFormatTest.LogName; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -53,7 +53,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { } @Test - public void frontendApi_doGET_RequestIdReceived() throws InterruptedException { + public void frontendApi_doGET_RequestIdReceived() { final Pair<HttpEntity, String> responseAndUuid = makeRequest( HttpMethod.GET, @@ -61,12 +61,12 @@ public class RequestIdFilterInstalled extends BaseApiTest { null, OperationalEnvironmentControllerApiTest.GET_CLOUD_RESOURCES_REQUEST_STATUS ); - assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); } @Test - public void frontendApi_doPOST_RequestIdReceived() throws InterruptedException { + public void frontendApi_doPOST_RequestIdReceived() { final Pair<HttpEntity, String> responseAndUuid = makeRequest( HttpMethod.POST, @@ -74,7 +74,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { "{}", ServiceInstanceMsoApiTest.DEACTIVATE_OK_JSON ); - assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); } @Test @@ -85,20 +85,20 @@ public class RequestIdFilterInstalled extends BaseApiTest { "/" + MSO_CREATE_CONFIGURATION, "i'm not a json" ); - assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.error, responseAndUuid); } @Test(groups = { "worksOnlyWithLocalhostVID" }) - public void mopOwningEntityApi_doGET_RequestIdReceived() throws InterruptedException { + public void mopOwningEntityApi_doGET_RequestIdReceived() { final Pair<HttpEntity, String> responseAndUuid = makeRequest( HttpMethod.GET, "/" + MAINTENANCE_CATEGORY_PARAMETER + "?familyName=PARAMETER_STANDARDIZATION", null ); - assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); /* test should be for: @@ -113,7 +113,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { } @Test - public void schedulerApi_doPOST_RequestIdReceived() throws InterruptedException { + public void schedulerApi_doPOST_RequestIdReceived() { final String anyInstanceId = "any instance id"; SimulatorApi.registerExpectation( @@ -130,7 +130,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { "/change-management/workflow/" + anyInstanceId, "{}" ); - assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); } @@ -139,12 +139,12 @@ public class RequestIdFilterInstalled extends BaseApiTest { final Pair<HttpEntity, String> responseAndUuid = makeRequest( HttpMethod.GET, "/healthCheck", null ); - assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); } - private void assertThatUuidInResponseAndUuidIsInARecentLog(Pair<HttpEntity, String> responseAndUuid) { + private void assertThatUuidInResponseAndUuidIsInARecentLog(LogName logName, Pair<HttpEntity, String> responseAndUuid) { assertThatResponseHasUuid(responseAndUuid.getLeft(), responseAndUuid.getRight()); - assertThatTermIsInARecentLog(responseAndUuid.getRight()); + assertThatTermIsInARecentLog(logName, responseAndUuid.getRight()); } private void assertThatResponseHasUuid(HttpEntity response, String uuid) { @@ -153,17 +153,13 @@ public class RequestIdFilterInstalled extends BaseApiTest { // id" filter, which is great! Assert.assertNotNull(response); List<String> ecompRequestIdHeaderValues = response.getHeaders().get(ECOMP_REQUEST_ID_ECHO); - Assert.assertThat(ecompRequestIdHeaderValues, hasItem(equalToIgnoringCase(uuid))); + assertThat(ecompRequestIdHeaderValues, hasItem(equalToIgnoringCase(uuid))); } - private void assertThatTermIsInARecentLog(String uuid) { - final ImmutableList<String> logLines = ImmutableList.of( - LoggerFormatTest.getLogLines("audit", 20, 0, restTemplate, uri), - LoggerFormatTest.getLogLines("error", 20, 0, restTemplate, uri) - ); + private void assertThatTermIsInARecentLog(LogName logName, String uuid) { + final String logLines = LoggerFormatTest.getLogLines(logName, 20, 0, restTemplate, uri); - // Assert that audit *OR* error has the uuid - assertThat("uuid not found in any log", logLines, hasItem(containsString(uuid))); + assertThat("uuid not found in any log", logLines, containsString(uuid)); } private Pair<HttpEntity, String> makeRequest(HttpMethod httpMethod, String url, String body) { @@ -184,9 +180,8 @@ public class RequestIdFilterInstalled extends BaseApiTest { SimulatorApi.registerExpectation("ecompportal_getSessionSlotCheckInterval.json", APPEND); HttpEntity entity = new HttpEntity<>(body, headers); - ResponseEntity<String> response = null; - response = restTemplateErrorAgnostic.exchange(uri + url, - httpMethod, entity, String.class); + ResponseEntity<String> response = + restTemplateErrorAgnostic.exchange(uri + url, httpMethod, entity, String.class); return Pair.of(response, uuid); } diff --git a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts index 3e90e2bb3..790fcfc67 100644 --- a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts @@ -33,7 +33,7 @@ describe('A la carte', function () { it(`service name should be mandatory : serviceEcompNaming = true`, ()=> { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { jsonBuilderAAIService.basicJson(res, Cypress.config('baseUrl') + '/rest/models/services/' + SERVICE_ID, 200, @@ -51,7 +51,7 @@ describe('A la carte', function () { const rollbackOnFailure : string = "true"; const projectName : string = "WATKINS"; const instanceName : string = "serviceInstanceName"; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setTestApiParamToGR(); res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte'; @@ -94,7 +94,7 @@ describe('A la carte', function () { it(`VNF a-la-carte`, ()=> { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setTestApiParamToGR(); res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte'; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null; @@ -145,7 +145,7 @@ describe('A la carte', function () { }); it(`Network a-la-carte`, ()=> { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setTestApiParamToGR(); res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte'; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null; @@ -199,7 +199,7 @@ describe('A la carte', function () { if (new Date() < timeBomb) { return; } - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setTestApiParamToGR(); res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte'; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null; diff --git a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts index f0db2c9e1..77eca9145 100644 --- a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts @@ -13,7 +13,7 @@ describe('Audit information modal', function () { win.sessionStorage.clear(); cy.setReduxState(); cy.preventErrorsOnLoading(); - jsonBuilderInstantiationBuilder.basicMock('/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json', + jsonBuilderInstantiationBuilder.basicMock('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json', Cypress.config('baseUrl') + "/asyncInstantiation**"); cy.initAAIMock(); cy.initVidMock(); diff --git a/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts index e787aa76c..ff43936a2 100644 --- a/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts @@ -29,7 +29,7 @@ describe('Browse SDC', function () { const MACRO_FOR_NEW_FLOW_ID: string = '74fa72dd-012b-49c3-800d-06b12bcaf1a0'; const CANCEL_BUTTON = "cancelButton"; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/bug616888/list-services.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/list-services.json').then((res) => { jsonBuilderAndMock.basicJson(res, Cypress.config('baseUrl') + '/rest/models/services?distributionStatus=DISTRIBUTED', 200, @@ -37,7 +37,7 @@ describe('Browse SDC', function () { 'list_services'); }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/bug616888/service-with-configuration.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/service-with-configuration.json').then((res) => { jsonBuilderAndMock.basicJson(res, Cypress.config('baseUrl') + '/rest/models/services/' + MACRO_WITH_NETWORK_ID, 200, @@ -45,7 +45,7 @@ describe('Browse SDC', function () { 'MACRO_WITH_CONFIGURATION'); }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/bug616888/Dror_service1806_Macro1.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/Dror_service1806_Macro1.json').then((res) => { jsonBuilderAndMock.basicJson(res, Cypress.config('baseUrl') + '/rest/models/services/' + MACRO_FOR_NEW_FLOW_ID, 200, @@ -67,7 +67,7 @@ describe('Browse SDC', function () { it(`browse sdc of service without instantiationType open aLaCarte popup`, function () { const VERY_OLD_SERVICE_UUID: string = "09c476c7-91ae-44b8-a731-04d8d8fa3695"; - const TEST_MOCKS_PATH="/cypress/support/jsonBuilders/mocks/jsons/bug_aLaCarteServiceWrongPopup/"; + const TEST_MOCKS_PATH="cypress/support/jsonBuilders/mocks/jsons/bug_aLaCarteServiceWrongPopup/"; const CANCEL_BUTTON = "cancelButton"; diff --git a/vid-webpack-master/cypress/integration/iFrames/changeManagement.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/changeManagement.e2e.ts index 268c3b9a6..219ffadda 100644 --- a/vid-webpack-master/cypress/integration/iFrames/changeManagement.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/changeManagement.e2e.ts @@ -14,7 +14,7 @@ describe('Change management AKA VNF changes', function () { cy.login(); cy.initAAIMock(); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => { jsonBuilderAAISubDetailsModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_details/e433710f-9217-458d-a79d-1c7aff376d89**", diff --git a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts index e150b93f7..a9cddfcbc 100644 --- a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts @@ -22,7 +22,7 @@ describe('Drawing board', function () { describe('duplicate', () => { it('delete vf module reduce the number of vf modules ', function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle'); @@ -40,7 +40,7 @@ describe('Drawing board', function () { }); it('create new vf module update the number of vf modules ', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle'); @@ -58,7 +58,7 @@ describe('Drawing board', function () { }); it('duplicate vnf multi - should update number of vf modules on left side and disable duplicate when created max', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle') @@ -267,7 +267,7 @@ describe('Drawing board', function () { }); xit('should display service model name', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); cy.get('#service-model-name').contains('action-data'); @@ -275,7 +275,7 @@ describe('Drawing board', function () { }); it('should display icon and message if no vnf and vnfModules', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { res.global.drawingBoardStatus = "CREATE"; cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); @@ -290,7 +290,7 @@ describe('Drawing board', function () { }); it('should show alert on remove vnf with modules', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0'); @@ -309,7 +309,7 @@ describe('Drawing board', function () { }); it('should not show alert on remove vnf without modules', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-0903e1c0-8e03-4936-b5c2-260653b96413-2017-388_PASQUALE-vPE 1'); @@ -318,7 +318,7 @@ describe('Drawing board', function () { }); it('should show <Automatically Assigned> if ecomp is true', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); cy.drawingBoardPressAddButtonByElementName('node-2017-388_PASQUALE-vPE 0').click({force: true}); @@ -338,7 +338,7 @@ describe('Drawing board', function () { it('should show model name if ecomp is false', () => { const vnfModelKey: string = '2017-488_PASQUALE-vPE 0', vnfModelName: string = '2017-488_PASQUALE-vPE'; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfModelKey].properties.ecomp_generated_naming = 'false'; cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); @@ -358,7 +358,7 @@ describe('Drawing board', function () { describe('add instance open a popup', () => { it('should add vfModule with popup with empty required instance name', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].properties.ecomp_generated_naming = "false"; res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].vfModules = []; cy.setReduxState(<any>res); @@ -369,7 +369,7 @@ describe('Drawing board', function () { }); it('should add vfModule with popup if empty required dynamic input', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1"].inputs["pasqualevpe0_bandwidth"].default = ''; res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].vfModules = []; cy.setReduxState(<any>res); @@ -385,7 +385,7 @@ describe('Drawing board', function () { describe('show warning and disable deploy button on vnf missing data', () => { it('show warning on vnf, and disable button, remove warning and enable button after edit', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => { res.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].existingVNFCounterMap['0903e1c0-8e03-4936-b5c2-260653b96413'] = 1; res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].validationCounter = 1; res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-388_PASQUALE-vPE 1"] = { @@ -426,7 +426,7 @@ describe('Drawing board', function () { describe('vnf should automatically displayed or not according its min value and its vf-modules min value', () => { it('vnf with min_instances value > 0 without required VF modules, should be created automatically without children', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].properties['min_instances'] = 1; res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"].properties['initialCount'] = 0; res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"].properties['initialCount'] = 0; @@ -445,7 +445,7 @@ describe('Drawing board', function () { }); it('vnf with min_instances value > 1 with required VF modules, should be created automatically with children only once', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].properties['min_instances'] = 3; cy.setReduxState(<any>res); cy.fillServicePopup().then(() => { @@ -461,7 +461,7 @@ describe('Drawing board', function () { it('vnf with min_instances value = 0 with required VF modules should be created automatically with its children', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_PASQUALE-vPE 0"].properties['min_instances'] = 0; cy.setReduxState(<any>res); cy.fillServicePopup().then(() => { @@ -478,7 +478,7 @@ describe('Drawing board', function () { it('vnf without min_instances and without required VF modules, should not exist automatically in right side', () => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { cy.setReduxState(<any>res); cy.fillServicePopup().then(() => { cy.visit("welcome.htm").then(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts index b358ad233..90dbcdd01 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts @@ -16,7 +16,7 @@ describe('Instantiation status', function () { cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); - jsonBuilderInstantiationBuilder.basicMock('/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json', + jsonBuilderInstantiationBuilder.basicMock('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json', Cypress.config('baseUrl') + "/asyncInstantiation**", (res: any) => { asyncRes = res; @@ -90,5 +90,5 @@ describe('Instantiation status', function () { cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-hide']`).should('not.exist'); cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-audit-info']`).should('not.exist'); }); - + }); diff --git a/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts index ec471aed6..387f34725 100644 --- a/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts @@ -148,7 +148,7 @@ describe('Network popup', function () { const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicNetworkModel.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicNetworkModel.json').then((res) => { jsonBuilderAndMock.basicJson(res, Cypress.config('baseUrl') + '/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450', 200, @@ -156,7 +156,7 @@ describe('Network popup', function () { 'initServiceModel'); }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicNetworkInstance.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicNetworkInstance.json').then((res) => { jsonBuilderAndMock.basicJson( res, Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb", diff --git a/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts index 97be48c9f..f14bc1b5b 100644 --- a/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts @@ -29,7 +29,7 @@ describe('Permissions ', ()=> { cy.initDrawingBoardUserPermission(<any>{isEditPermitted : false}); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { jsonBuilderAndMock.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", @@ -61,7 +61,7 @@ describe('Permissions ', ()=> { cy.initDrawingBoardUserPermission(); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { jsonBuilderAndMock.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", diff --git a/vid-webpack-master/cypress/integration/iFrames/resume.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/resume.e2e.ts index cec915a91..5857e1ac0 100644 --- a/vid-webpack-master/cypress/integration/iFrames/resume.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/resume.e2e.ts @@ -13,7 +13,7 @@ describe('Resume tests', function () { let jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>(); let jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>(); beforeEach(() => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/defect710619/serviceE2E.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/serviceE2E.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/**", @@ -22,7 +22,7 @@ describe('Resume tests', function () { }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubViewEditForServiceWithSomeVFModuleE2E.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubViewEditForServiceWithSomeVFModuleE2E.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**", @@ -31,7 +31,7 @@ describe('Resume tests', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => { jsonBuilderAAISubDetailsModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_details/**", @@ -40,7 +40,7 @@ describe('Resume tests', function () { "aai-sub-details") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiServiceInstancesE2E.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiServiceInstancesE2E.json').then((res) => { jsonBuilderAaiServiceInstances.basicJson( res, Cypress.config('baseUrl') + "/search_service_instances**", @@ -76,7 +76,7 @@ describe('Resume tests', function () { it(`Resume Defect 710619 - with flag FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE is OFF`, function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/flags.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.json').then((res) => { cy.server() .route({ method: 'GET', @@ -108,7 +108,7 @@ describe('Resume tests', function () { .getElementByDataTestsId('tenant').should('be.visible').select("bae71557c5bb4d5aac6743a4e5f1d054"); cy.getElementByDataTestsId('confirmResumeDeleteButton').not('.button--inactive').click().then(()=> { cy.wait('@actualResumeCall').then(xhr => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json').then((expectedResult) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json').then((expectedResult) => { cy.deepCompare(xhr.request.body, expectedResult); }); }); diff --git a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts index 683e1d96c..60c07f4e7 100644 --- a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts @@ -10,7 +10,7 @@ describe('Retry Page', function () { win.sessionStorage.clear(); cy.preventErrorsOnLoading(); cy.initAAIMock(); - jsonBuilderAndMock.basicMock('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json', + jsonBuilderAndMock.basicMock('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json', Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450"); cy.initVidMock(); cy.initZones(); @@ -115,7 +115,7 @@ describe('Retry Page', function () { res.vnfs["2017-488_PASQUALE-vPE 0"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].isFailed = true; res.vnfs["2017-488_PASQUALE-vPE 0"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].action = 'Create'; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/responceForFailedInstance.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/responceForFailedInstance.json').then((res) => { jsonBuilderAndMock.basicJson( res, Cypress.config('baseUrl') + "/asyncInstantiation/auditStatusForRetry**", diff --git a/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts index 0e6893044..26173549b 100644 --- a/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts @@ -62,7 +62,7 @@ describe('search existing instance', function () { response: searchServiceInstancesResponse }).as('search_service_instances'); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/serviceForNewViewEdit.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/serviceForNewViewEdit.json').then((res) => { jsonBuilderAndMock.basicJson( res, Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_VERSION_ID}`, diff --git a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts index 4af4a14ca..d95cfdb32 100644 --- a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts @@ -18,7 +18,7 @@ describe('Service popup', function () { }); it('a-la-carte service instantiation popup has all required fields ', function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte'; cy.setReduxState(<any>res1); cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); @@ -33,7 +33,7 @@ describe('Service popup', function () { }); it('a-la-carte service instantiation popup has Instance name as required', function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte'; let isEcompNaming = false; res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.serviceEcompNaming = isEcompNaming.toString(); @@ -75,7 +75,7 @@ describe('Service popup', function () { it('should display error when api return empty data', function () { cy.initCategoryParameter(<any>{}); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { res1.service.categoryParameters.owningEntityList = []; cy.setReduxState(<any>res1); cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); diff --git a/vid-webpack-master/cypress/integration/iFrames/serviceWithNetwork.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/serviceWithNetwork.e2e.ts index 8e297d0c9..19a3be93b 100644 --- a/vid-webpack-master/cypress/integration/iFrames/serviceWithNetwork.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/serviceWithNetwork.e2e.ts @@ -9,7 +9,7 @@ import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewE describe('View Edit Page', function () { describe('test view service with network', () => { var jsonBuilderAAIService : JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); - const presetsPrefix : string = '/cypress/support/jsonBuilders/mocks/jsons/'; + const presetsPrefix : string = 'cypress/support/jsonBuilders/mocks/jsons/'; var jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>(); var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>(); diff --git a/vid-webpack-master/cypress/integration/iFrames/serviceWithVnfNetwork.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/serviceWithVnfNetwork.e2e.ts index a1af531c1..24ddc9bfe 100644 --- a/vid-webpack-master/cypress/integration/iFrames/serviceWithVnfNetwork.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/serviceWithVnfNetwork.e2e.ts @@ -17,7 +17,7 @@ describe('Service With VNF network', function () { var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>(); var jsonBuilderEmpty: JsonBuilder<Object> = new JsonBuilder<Object>(); beforeEach(() => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44", @@ -27,7 +27,7 @@ describe('Service With VNF network', function () { }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForComplexService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForComplexService.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d", @@ -36,7 +36,7 @@ describe('Service With VNF network', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { jsonBuilderAAISubDetailsModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_details/**", @@ -45,7 +45,7 @@ describe('Service With VNF network', function () { "aai-sub-details") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { jsonBuilderAaiServiceInstances.basicJson( res, Cypress.config('baseUrl') + "/search_service_instances**", diff --git a/vid-webpack-master/cypress/integration/iFrames/softDeleteAndResume.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/softDeleteAndResume.e2e.ts index b83268ece..fccdd53c6 100644 --- a/vid-webpack-master/cypress/integration/iFrames/softDeleteAndResume.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/softDeleteAndResume.e2e.ts @@ -13,7 +13,7 @@ describe('Soft delete tests', function () { var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>(); var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>(); beforeEach(() => { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44", @@ -23,7 +23,7 @@ describe('Soft delete tests', function () { }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForServiceWithSomeVFModule.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForServiceWithSomeVFModule.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d", @@ -32,7 +32,7 @@ describe('Soft delete tests', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { jsonBuilderAAISubDetailsModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_details/**", @@ -41,7 +41,7 @@ describe('Soft delete tests', function () { "aai-sub-details") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { jsonBuilderAaiServiceInstances.basicJson( res, Cypress.config('baseUrl') + "/search_service_instances**", @@ -75,7 +75,7 @@ describe('Soft delete tests', function () { it(`Resume button display in orch status - pendingactivation, assigned - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is OFF`, function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/flags.json').then(() => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.json').then(() => { cy.server() .route({ method: 'GET', @@ -136,7 +136,7 @@ describe('Soft delete tests', function () { it(`Soft delete button display with partial homing data from AAI`, function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => { jsonBuilderAaiServiceInstances.basicJson( res, Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/c015cc0f-0f37-4488-aabf-53795fd93cd3/a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts index abbe1121b..fc568c072 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts @@ -23,7 +23,7 @@ describe('View Edit Page', function () { cy.window().then((win) => { win.sessionStorage.clear(); }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/" + commonUuid, @@ -32,7 +32,7 @@ describe('View Edit Page', function () { changeServiceModel) }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicFabricConfigService.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d671234", @@ -40,7 +40,7 @@ describe('View Edit Page', function () { "service-FabricConfig", changeFabric) }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/activeFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/activeFabricConfigService.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d675678", @@ -48,7 +48,7 @@ describe('View Edit Page', function () { "service-FabricConfig", changeFabric) }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/createdFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/createdFabricConfigService.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d679000", @@ -56,7 +56,7 @@ describe('View Edit Page', function () { "service-FabricConfig", changeFabric) }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/deactivatedFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/deactivatedFabricConfigService.json').then((res) => { jsonBuilderAAIService.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d671000", @@ -64,7 +64,7 @@ describe('View Edit Page', function () { "service-FabricConfig", changeFabric) }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForComplexService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForComplexService.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d", @@ -73,7 +73,7 @@ describe('View Edit Page', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForFabricConfigService.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/c187e9fe-40c3-4862-b73e-84ff056205f61234", @@ -82,7 +82,7 @@ describe('View Edit Page', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForActiveFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForActiveFabricConfigService.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/c187e9fe-40c3-4862-b73e-84ff056205f65678", @@ -91,7 +91,7 @@ describe('View Edit Page', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForCreatedFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForCreatedFabricConfigService.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/c187e9fe-40c3-4862-b73e-84ff056205f69000", @@ -100,7 +100,7 @@ describe('View Edit Page', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForDeactivatedFabricConfigService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForDeactivatedFabricConfigService.json').then((res) => { jsonBuilderAAISubViewEditModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/c187e9fe-40c3-4862-b73e-84ff056205f61000", @@ -109,7 +109,7 @@ describe('View Edit Page', function () { "aai-sub-view-edit") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { jsonBuilderAAISubDetailsModel.basicJson( res, Cypress.config('baseUrl') + "/aai_sub_details/**", @@ -118,7 +118,7 @@ describe('View Edit Page', function () { "aai-sub-details") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstancePnfs.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstancePnfs.json').then((res) => { jsonBuilderPNF.basicJson( res, Cypress.config('baseUrl') + "/aai_get_service_instance_pnfs/**", @@ -127,7 +127,7 @@ describe('View Edit Page', function () { "aai-get-service-instance-pnfs") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { jsonBuilderAaiServiceInstances.basicJson( res, Cypress.config('baseUrl') + "/search_service_instances**", @@ -136,7 +136,7 @@ describe('View Edit Page', function () { "aai-get-service-instances") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyObjectResponse.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyObjectResponse.json').then((res) => { jsonBuilderEmpty.basicJson( res, Cypress.config('baseUrl') + "/aai_getPortMirroringConfigsData**", @@ -145,7 +145,7 @@ describe('View Edit Page', function () { "aai_getPortMirroringConfigsDate - empty response") }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyObjectResponse.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyObjectResponse.json').then((res) => { jsonBuilderEmpty.basicJson( res, Cypress.config('baseUrl') + "/aai_getPortMirroringSourcePorts**", diff --git a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts index fecf9596a..e5be3fb98 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts @@ -63,7 +63,7 @@ describe('View only drawing board', function () { const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { jsonBuilderInstantiationBuilder.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", @@ -86,7 +86,7 @@ describe('View only drawing board', function () { const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { jsonBuilderAndMock.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts index e377d72dc..2c9850048 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts @@ -45,7 +45,7 @@ describe('Vnf popup', function () { }); it('should display min/max', function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'].properties.min_instances = 100; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'].properties.max_instances = 200; cy.setReduxState(<any>res); @@ -59,7 +59,7 @@ describe('Vnf popup', function () { }); it('should display default values for undefined min/max', function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'].properties.min_instances = null; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'].properties.max_instances = null; cy.setReduxState(<any>res); @@ -73,7 +73,7 @@ describe('Vnf popup', function () { }); it('fill all fields of vnf popup', function () { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'].min = null; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'].max = null; cy.setReduxState(<any>res); diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts index b1ba76952..7c942ea54 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts @@ -37,7 +37,7 @@ describe('Delete vnf instance', function () { response: "[]", }).as("expectedPostAsyncInstantiation"); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { res.service.vidNotions.instantiationType = 'ALaCarte'; jsonBuilderAndMock.basicJson( res, diff --git a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts index f9c188bd7..cd21f4e54 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts @@ -81,11 +81,11 @@ describe('Vnf Groups', function () { serviceModel = res; }); - cy.readFile('./cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => { basicServiceInstance = res; }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => { reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel; reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance; @@ -137,11 +137,11 @@ describe('Vnf Groups', function () { serviceModel = res; }); - cy.readFile('./cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => { basicServiceInstance = res; }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => { reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel; reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance; @@ -696,7 +696,7 @@ describe('Vnf Groups', function () { ) }); - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => { reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel; diff --git a/vid-webpack-master/cypress/integration/iFrames/welcomePage.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/welcomePage.e2e.ts index 5b34ee57f..5a0b963dc 100644 --- a/vid-webpack-master/cypress/integration/iFrames/welcomePage.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/welcomePage.e2e.ts @@ -24,7 +24,7 @@ describe('Welcome page', function () { it(`verifying VID version"`, function () { const APP_VERSION = "1902.1948"; - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/version.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/version.json').then((res) => { jsonBuilderAndMock.basicJson(res, Cypress.config('baseUrl') + '/version', 200, diff --git a/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts b/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts index 69021132c..55f90cc69 100644 --- a/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts @@ -24,7 +24,7 @@ describe('Error message popup', function () { it('error should display on api error', function () { // adding call with delay of 2000 sec - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json').then((res) => { jsonBuilderInstantiationBuilder.basicJson(res, Cypress.config('baseUrl') + "/asyncInstantiation**", 500,0, "error 500 asyncInstantiation"); cy.openIframe('app/ui/#/instantiationStatus'); diff --git a/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts b/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts index 438e7bc3a..cd14a1247 100644 --- a/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts +++ b/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts @@ -25,7 +25,7 @@ describe('Spinner', function () { const timeBomb:Date = new Date(2018,6,10,0,0,0); //month 6 is July if (new Date(Date.now()) > timeBomb) { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json').then((res) => { jsonBuilderInstantiationBuilder.basicJson(res, Cypress.config('baseUrl') + "/asyncInstantiation**", diff --git a/vid-webpack-master/cypress/support/application/application.session.actions.ts b/vid-webpack-master/cypress/support/application/application.session.actions.ts index 84114aa36..42d4d6766 100644 --- a/vid-webpack-master/cypress/support/application/application.session.actions.ts +++ b/vid-webpack-master/cypress/support/application/application.session.actions.ts @@ -12,7 +12,7 @@ declare namespace Cypress { Type to input with id some text *********************************/ function setReduxState(state?: string) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => { cy.window().then((win) => { win.sessionStorage.setItem('reduxState', JSON.stringify(state ? state : res)); }); diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts b/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts index acb58c261..669db055c 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts @@ -11,7 +11,7 @@ declare namespace Cypress { } function initGetSubscribers(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/subscribers.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/subscribers.json').then((res) => { cy.server() .route({ method: 'GET', @@ -23,7 +23,7 @@ function initGetSubscribers(response? : JSON) : void { } function initAaiGetFullSubscribers(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/subscribers.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/subscribers.json').then((res) => { cy.server() .route({ method: 'GET', @@ -35,7 +35,7 @@ function initAaiGetFullSubscribers(response? : JSON) : void { } function initGetAAISubDetails(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { cy.server() .route({ method: 'GET', @@ -47,7 +47,7 @@ function initGetAAISubDetails(response? : JSON) : void { } function initAlaCarteService(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/a-la-carteService.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/a-la-carteService.json').then((res) => { cy.server() .route({ method: 'GET', @@ -63,7 +63,7 @@ function initAlaCarteService(response? : JSON) : void { function initTenants(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/tenants.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/tenants.json').then((res) => { cy.server() .route({ method: 'GET', @@ -75,7 +75,7 @@ function initTenants(response? : JSON) : void { } function initAAIServices(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiServices.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServices.json').then((res) => { cy.server() .route({ method: 'GET', @@ -87,7 +87,7 @@ function initAAIServices(response? : JSON) : void { } function initZones(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/zones.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/zones.json').then((res) => { cy.server() .route({ method: 'GET', @@ -124,7 +124,7 @@ function initActiveNetworks(response? : JSON) : void { } function initActiveVPNs(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiActiveVPNs.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiActiveVPNs.json').then((res) => { cy.server() .route({ method: 'GET', diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts b/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts index 9698f47bb..052fb8a4c 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts @@ -17,7 +17,7 @@ function preventErrorsOnLoading() : void { } function initGetToMenuInfo(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/topMenuInfo.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/topMenuInfo.json').then((res) => { cy.server() .route({ method: 'GET', @@ -31,7 +31,7 @@ function initGetToMenuInfo(response? : JSON) : void { function initCategoryParameter(response? : JSON) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/categoryParametres.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/categoryParametres.json').then((res) => { cy.server() .route({ method: 'GET', @@ -43,7 +43,7 @@ function initCategoryParameter(response? : JSON) : void { } function initFlags(response? : JSON, delay?: number, status?: number) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/flags.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.json').then((res) => { cy.server() .route({ method: 'GET', @@ -56,7 +56,7 @@ function initFlags(response? : JSON, delay?: number, status?: number) : void { } function initAuditInfoVID(response? : JSON, delay?: number, status?: number) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/auditInfoVid.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/auditInfoVid.json').then((res) => { cy.server() .route({ method: 'GET', @@ -69,7 +69,7 @@ function initAuditInfoVID(response? : JSON, delay?: number, status?: number) : v } function initAuditInfoMSO(response? : JSON, delay?: number, status?: number) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/auditInfoMSO.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/auditInfoMSO.json').then((res) => { cy.server() .route({ method: 'GET', @@ -95,7 +95,7 @@ function initAuditInfoMSOALaCarte(response? : JSON, delay?: number, status?: num } function initAsyncInstantiation(response? : JSON, delay?: number, status?: number) : void { - cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicAsyncInstantiation.json').then((res) => { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicAsyncInstantiation.json').then((res) => { cy.server() .route({ method: 'GET', |