-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qa 5637 refactor classe miglioramento classe invio notifiche b2b steps #667
base: develop
Are you sure you want to change the base?
Changes from all commits
cd95313
d410dd5
25055e8
3fe8e86
cbd70b3
6eccf73
776b6de
e59d0db
c49fabf
04a5551
fadaf56
a14fab7
cd88aa1
6612c37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import static java.util.concurrent.TimeUnit.MILLISECONDS; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.within; | ||
import static org.assertj.core.api.SoftAssertions.assertSoftly; | ||
import static org.awaitility.Awaitility.await; | ||
|
||
import io.cucumber.datatable.DataTable; | ||
|
@@ -152,12 +153,11 @@ public void readingEventsNotificationPA(String status, String pa) { | |
public void readingEventUpToTheStatusOfNotification(String status) { | ||
PnPollingPredicate pnPollingPredicate = new PnPollingPredicate(); | ||
pnPollingPredicate.setNotificationStatusHistoryElementPredicateV26( | ||
statusHistory -> statusHistory | ||
.getStatus() | ||
.getValue().equals(status) | ||
statusHistory -> statusHistory.getStatus().getValue().equals(status) | ||
); | ||
|
||
PnPollingServiceStatusRapidV26 statusRapidV26 = (PnPollingServiceStatusRapidV26) pnPollingFactory.getPollingService(PnPollingStrategy.STATUS_RAPID_V26); | ||
PnPollingServiceStatusRapidV26 statusRapidV26 = | ||
(PnPollingServiceStatusRapidV26) pnPollingFactory.getPollingService(PnPollingStrategy.STATUS_RAPID_V26); | ||
|
||
PnPollingResponseV26 pnPollingResponseV26 = statusRapidV26.waitForEvent(sharedSteps.getSentNotification().getIun(), | ||
PnPollingParameter.builder() | ||
|
@@ -166,12 +166,20 @@ public void readingEventUpToTheStatusOfNotification(String status) { | |
.build()); | ||
log.info("NOTIFICATION_STATUS_HISTORY: " + pnPollingResponseV26.getNotification().getNotificationStatusHistory()); | ||
try { | ||
Assertions.assertTrue(pnPollingResponseV26.getResult()); | ||
Assertions.assertNotNull(pnPollingResponseV26.getNotificationStatusHistoryElement()); | ||
assertThat(pnPollingResponseV26.getResult()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discorso simile al primo punto sollevato: cosa significherebbe che il risultato sia false? Che è stato raggiunto un polling timeout. Possibile messaggio: "L'elemento di timeline cercato non è stato rilevato dopo {int} tentativi separati ciascuno da un intervallo di {int} secondi, è possibile che non sia arrivato o che sia arrivato in ritardo." |
||
.as("Il risultato del polling deve essere valorizzato") | ||
.isTrue(); | ||
|
||
assertThat(pnPollingResponseV26.getNotificationStatusHistoryElement()) | ||
.as("L'elemento dello storico degli stati non dovrebbe essere nullo") | ||
.isNotNull(); | ||
|
||
sharedSteps.setSentNotification(pnPollingResponseV26.getNotification()); | ||
log.info("NOTIFICATION_STATUS_HISTORY_ELEMENT: " + pnPollingResponseV26.getNotificationStatusHistoryElement()); | ||
} catch (AssertionFailedError assertionFailedError) { | ||
sharedSteps.throwAssertFailerWithIUN(assertionFailedError); | ||
|
||
log.info("NOTIFICATION_STATUS_HISTORY_ELEMENT: {}", pnPollingResponseV26.getNotificationStatusHistoryElement()); | ||
|
||
} catch (AssertionError assertionError) { | ||
sharedSteps.throwAssertFailerWithIUN(assertionError); | ||
} | ||
} | ||
|
||
|
@@ -698,24 +706,38 @@ public void verificationDateScheduleRefinementWithSendAnalogFeedback(Integer des | |
} | ||
|
||
public TimelineElementV26 readingEventUpToTheTimelineElementOfNotificationForCategory(String timelineEventCategory) { | ||
PnPollingServiceTimelineSlowV26 timelineSlowV26 = (PnPollingServiceTimelineSlowV26) pnPollingFactory.getPollingService(PnPollingStrategy.TIMELINE_SLOW_V26); | ||
PnPollingServiceTimelineSlowV26 timelineSlowV26 = | ||
(PnPollingServiceTimelineSlowV26) pnPollingFactory.getPollingService(PnPollingStrategy.TIMELINE_SLOW_V26); | ||
|
||
PnPollingResponseV26 pnPollingResponseV26 = timelineSlowV26.waitForEvent(sharedSteps.getIunVersionamento(), | ||
PnPollingResponseV26 pnPollingResponseV26 = timelineSlowV26.waitForEvent( | ||
sharedSteps.getIunVersionamento(), | ||
PnPollingParameter.builder() | ||
.value(timelineEventCategory) | ||
.build()); | ||
log.info("NOTIFICATION_TIMELINE: " + pnPollingResponseV26.getNotification().getTimeline()); | ||
|
||
try { | ||
Assertions.assertTrue(pnPollingResponseV26.getResult()); | ||
Assertions.assertNotNull(pnPollingResponseV26.getTimelineElement()); | ||
assertThat(pnPollingResponseV26.getResult()) | ||
.as("Il risultato del polling dovrebbe essere valorizzato, Primo controllo: Verificare che l'elemento sia presente in timeline e le tempistiche con cui viene prodotto") | ||
.isTrue(); | ||
|
||
assertThat(pnPollingResponseV26.getTimelineElement()) | ||
.as("L'elemento della timeline non dovrebbe essere nullo") | ||
.isNotNull(); | ||
|
||
sharedSteps.setSentNotification(pnPollingResponseV26.getNotification()); | ||
|
||
TimelineElementV26 timelineElement = pnPollingResponseV26.getTimelineElement(); | ||
log.info("TIMELINE_ELEMENT: " + timelineElement); | ||
sharedSteps.setTimelineElement(timelineElement); | ||
} catch (AssertionFailedError assertionFailedError) { | ||
sharedSteps.throwAssertFailerWithIUN(assertionFailedError); | ||
|
||
return timelineElement; | ||
|
||
} catch (AssertionError assertionError) { | ||
sharedSteps.throwAssertFailerWithIUN(assertionError); | ||
} | ||
return pnPollingResponseV26.getTimelineElement(); | ||
|
||
return null; | ||
} | ||
|
||
public TimelineElementV26 readingEventUpToTheTimelineElementOfNotificationForCategoryExtraRapid(String timelineEventCategory) { | ||
|
@@ -907,14 +929,33 @@ public void readingEventUpToTheTimelineElementOfNotificationAndCancel(String tim | |
public void readingEventUpToTheTimelineElementOfNotificationWithDeliveryDetailCode(String timelineEventCategory, String deliveryDetailCode) { | ||
PnPollingResponseV26 pnPollingResponseV26 = getPollingResponse(timelineEventCategory, deliveryDetailCode); | ||
|
||
log.info("NOTIFICATION_TIMELINE: " + pnPollingResponseV26.getNotification().getTimeline()); | ||
|
||
|
||
Objects.requireNonNull( pnPollingResponseV26.getNotification(), "La notifica non può essere null"); | ||
log.info("NOTIFICATION_TIMELINE: {}", pnPollingResponseV26.getNotification().getTimeline()); | ||
|
||
|
||
try { | ||
Assertions.assertTrue(pnPollingResponseV26.getResult(), "Polling failed. IUN: " + sharedSteps.getSentNotification().getIun()); | ||
Assertions.assertNotNull(pnPollingResponseV26.getTimelineElement(), "The timeline element was not found. IUN: " + sharedSteps.getSentNotification().getIun()); | ||
assertSoftly(softly -> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uso tecnicamente corretto delle soft assertions, tuttavia se il polling non ha avuto successo allora non sarà presente un elemento di timeline, dunque in questo caso sospetto se ne possa fare a meno EDIT: sorge il dubbio sul perché fare il secondo controllo a prescindere, se teoricamente basta il primo |
||
softly.assertThat(pnPollingResponseV26.getResult()) | ||
.as("Verifica che il polling abbia avuto successo per IUN: " + | ||
(sharedSteps.getSentNotification() != null ? sharedSteps.getSentNotification().getIun() : "UNKNOWN")) | ||
.isTrue(); | ||
|
||
softly.assertThat(pnPollingResponseV26.getTimelineElement()) | ||
.as("Verifica che l'elemento di timeline esista per IUN: " + | ||
(sharedSteps.getSentNotification() != null ? sharedSteps.getSentNotification().getIun() : "UNKNOWN")) | ||
.isNotNull(); | ||
}); | ||
|
||
sharedSteps.setSentNotification(pnPollingResponseV26.getNotification()); | ||
log.info("TIMELINE_ELEMENT: " + pnPollingResponseV26.getTimelineElement()); | ||
} catch (AssertionFailedError assertionFailedError) { | ||
sharedSteps.throwAssertFailerWithIUN(assertionFailedError); | ||
|
||
if (pnPollingResponseV26.getTimelineElement() != null) { | ||
log.info("TIMELINE_ELEMENT: {}", pnPollingResponseV26.getTimelineElement()); | ||
} | ||
|
||
} catch (AssertionError assertionError) { | ||
sharedSteps.throwAssertFailerWithIUN(assertionError); | ||
} | ||
} | ||
|
||
|
@@ -3685,17 +3726,28 @@ public void checkLegalFactAllVersions(String timelineElementCategory, String leg | |
log.info("LEGAL FACT CATEGORY = " + legalFact.getCategory()); | ||
log.info("LEGAL FACT URL: " + legalFact.getKey()); | ||
} | ||
|
||
@Then("esiste l'elemento di timeline della notifica {string} abbia notificationCost uguale a {string} per l'utente {int}") | ||
public void TimelineElementOfNotificationUserCost(String timelineEventCategory, String cost, Integer destinatario) { | ||
|
||
TimelineElementV26 event = readingEventUpToTheTimelineElementOfNotificationForCategoryUser(timelineEventCategory, destinatario); | ||
|
||
|
||
|
||
Long notificationCost = event.getDetails().getNotificationCost(); | ||
|
||
if (cost.equalsIgnoreCase("null")) { | ||
Assertions.assertNull(notificationCost); | ||
assertThat(notificationCost) | ||
.as("Il notificationCost dovrebbe essere null per la categoria '%s' e destinatario '%d'", timelineEventCategory, destinatario) | ||
.isNull(); | ||
} else if (cost.equalsIgnoreCase("NotNull")) { | ||
Assertions.assertNotNull(notificationCost); | ||
assertThat(notificationCost) | ||
.as("Il notificationCost non dovrebbe essere null per la categoria '%s' e destinatario '%d'", timelineEventCategory, destinatario) | ||
.isNotNull(); | ||
} else { | ||
Assertions.assertEquals(Long.parseLong(cost), notificationCost); | ||
assertThat(notificationCost) | ||
.as("Il notificationCost dovrebbe essere uguale a '%s' per la categoria '%s' e destinatario '%d'", cost, timelineEventCategory, destinatario) | ||
.isEqualTo(Long.parseLong(cost)); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(le osservazioni fatte su questo file sono estensibili a tutto ciò che riguarda i test)