diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-10-31 15:00:10 +0200 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2019-10-31 21:38:46 +0000 |
commit | 17f0d7ae3aaaddb4c20b5159d42d00cc40ebf0e0 (patch) | |
tree | 1744d87185bf3341512d3178874fa09298806840 /vid-automation/src/test/java/org/onap | |
parent | a867b83b9ce1a5ea9793d4fc76d39f2973c9174a (diff) |
remove 2016 logger aspects + verify audit score
Issue-ID: VID-253
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: I841205c5b78ba46041279a36d57f4b1afa665deb
Diffstat (limited to 'vid-automation/src/test/java/org/onap')
3 files changed, 51 insertions, 39 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationMacroApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationMacroApiTest.java index 1f0b0f3aa..538a4d03a 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationMacroApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationMacroApiTest.java @@ -1,21 +1,57 @@ package org.onap.vid.api; +import static java.util.stream.Collectors.counting; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toMap; +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.hasSize; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; +import static vid.automation.test.infra.Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; +import static vid.automation.test.utils.ExtendedHamcrestMatcher.hasItemsFromCollection; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; +import java.util.stream.Stream; import net.bytebuddy.utility.RandomString; import net.javacrumbs.jsonunit.JsonAssert; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.hamcrest.collection.IsCollectionWithSize; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; -import org.onap.simulator.presetGenerator.presets.mso.*; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAssignServiceInstanceGen2WithNames; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNames; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteMacroService; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGetErrorResponse; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsManyInstanceStatusesGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2ErrorResponse; import org.onap.vid.model.asyncInstantiation.JobAuditStatus; import org.onap.vid.model.asyncInstantiation.ServiceInfo; -import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpServerErrorException; @@ -28,23 +64,6 @@ import vid.automation.test.model.JobStatus; import vid.automation.test.model.ServiceAction; import vid.automation.test.services.SimulatorApi; -import java.util.*; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.IntStream; -import java.util.stream.Stream; - -import static java.util.stream.Collectors.*; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; -import static vid.automation.test.infra.Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; -import static vid.automation.test.utils.ExtendedHamcrestMatcher.hasItemsFromCollection; - public class AsyncInstantiationMacroApiTest extends AsyncInstantiationBase { private static final Logger logger = LogManager.getLogger(AsyncInstantiationMacroApiTest.class); @@ -116,9 +135,12 @@ public class AsyncInstantiationMacroApiTest extends AsyncInstantiationBase { deleteOneJobHavingTheStatus(jobs, JobStatus.IN_PROGRESS); } catch (HttpClientErrorException e) { JsonAssert.assertJsonPartEquals( - "Service status does not allow deletion from the queue (Request id: null)", - e.getResponseBodyAsString(), - "message" + String.format( + "Service status does not allow deletion from the queue (Request id: %s)", + e.getResponseHeaders().getFirst("X-ECOMP-RequestID-echo") + ), + e.getResponseBodyAsString(), + "message" ); assertThat(e.getStatusCode(), is(HttpStatus.METHOD_NOT_ALLOWED)); 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 7f2d48469..81d255391 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 @@ -40,7 +40,7 @@ public class LoggerFormatTest extends BaseApiTest { private final Logger logger = LogManager.getLogger(LoggerFormatTest.class); public enum LogName { - audit, error, audit2019, metrics2019, metrics + audit2019, error, metrics2019 } @BeforeClass @@ -54,13 +54,8 @@ public class LoggerFormatTest extends BaseApiTest { } @Test - public void validateAuditLogsFormat() { - validateLogsFormat(LogName.audit); - } - - @Test public void validateAudit2019LogsFormat() { - validateLogsFormat(LogName.audit2019, "audit-ELS-2019.11", 0); + validateLogsFormat(LogName.audit2019, "audit-ELS-2019.11", 0.8); } @Test(enabled = false) // no total-score is returned for error-log @@ -69,11 +64,6 @@ public class LoggerFormatTest extends BaseApiTest { } @Test - public void validateMetricsLogsFormat() { - validateLogsFormat(LogName.metrics, "metric"); - } - - @Test public void validateMetrics2019LogsFormat() { validateLogsFormat(LogName.metrics2019, "metric-ELS-2019.11"); } 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 07bd3b0dc..93ab14036 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 @@ -61,7 +61,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { null, OperationalEnvironmentControllerApiTest.GET_CLOUD_RESOURCES_REQUEST_STATUS ); - assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit2019, responseAndUuid); } @@ -74,7 +74,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { "{}", ServiceInstanceMsoApiTest.DEACTIVATE_OK_JSON ); - assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit2019, responseAndUuid); } @Test @@ -98,7 +98,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { "/" + MAINTENANCE_CATEGORY_PARAMETER + "?familyName=PARAMETER_STANDARDIZATION", null ); - assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit2019, responseAndUuid); /* test should be for: @@ -130,7 +130,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { "/change-management/workflow/" + anyInstanceId, "{}" ); - assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit2019, responseAndUuid); } @@ -139,7 +139,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { final Pair<HttpEntity, String> responseAndUuid = makeRequest( HttpMethod.GET, "/healthCheck", null ); - assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit, responseAndUuid); + assertThatUuidInResponseAndUuidIsInARecentLog(LogName.audit2019, responseAndUuid); } private void assertThatUuidInResponseAndUuidIsInARecentLog(LogName logName, Pair<HttpEntity, String> responseAndUuid) { |