Skip to content

Commit

Permalink
Remove unnecessary phrases data model (#288)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Kliuchnikau <akliuchn@gmail.com>
  • Loading branch information
draker94 and Andrei Kliuchnikau authored Aug 16, 2024
1 parent d52eecf commit 159844a
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public class MessageData {
private final BuildData buildData;
private final SummaryData summaryData;
private final String suitesSummaryJson;
private final PhrasesData phrasesData;
private final Phrases phrases;
private Map<String, Object> data;

public MessageData(Base base, Summary summary, String suitesSummaryJson, Phrases phrases) {
this.project = base.getProject();
this.buildData = new BuildData(base);
this.summaryData = new SummaryData(base, summary);
this.suitesSummaryJson = suitesSummaryJson;
this.phrasesData = new PhrasesData(phrases);
this.phrases = phrases;
}

public Map<String, Object> getValues() {
Expand All @@ -39,7 +39,7 @@ public Map<String, Object> getValues() {
data.putAll(buildData.map());
data.putAll(summaryData.map());
data.put("suitesSummaryJson", suitesSummaryJson);
data.putAll(phrasesData.map());
data.put("phrases", phrases);
log.info("Template data: {}", data);
}
return data;
Expand Down

This file was deleted.

38 changes: 19 additions & 19 deletions allure-notifications-api/src/main/resources/templates/html.ftl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<#compress>
<h3>${results}:</h3>
<b>${environment}: </b>${env}<br/>
<b>${comment}: </b>${comm}<br/>
<b>${duration}: </b>${time}<br/>
<b>${totalScenarios}: </b>${total}
<h3>${phrases.results}:</h3>
<b>${phrases.environment}: </b>${env}<br/>
<b>${phrases.comment}: </b>${comm}<br/>
<b>${phrases.scenario.duration}: </b>${time}<br/>
<b>${phrases.scenario.totalScenarios}: </b>${total}
<ul>
<#if passed != 0 ><li><b>${totalPassed}: </b>${passed} (${passedPercentage} %)</li></#if>
<#if failed != 0 ><li><b>${totalFailed}: </b>${failed} (${failedPercentage} %)</li></#if>
<#if broken != 0 ><li><b>${totalBroken}: </b>${broken}</li></#if>
<#if unknown != 0 ><li><b>${totalUnknown}: </b>${unknown}</li></#if>
<#if skipped != 0 ><li><b>${totalSkipped}: </b>${skipped}</li></#if>
<#if passed != 0 ><li><b>${phrases.scenario.totalPassed}: </b>${passed} (${passedPercentage} %)</li></#if>
<#if failed != 0 ><li><b>${phrases.scenario.totalFailed}: </b>${failed} (${failedPercentage} %)</li></#if>
<#if broken != 0 ><li><b>${phrases.scenario.totalBroken}: </b>${broken}</li></#if>
<#if unknown != 0 ><li><b>${phrases.scenario.totalUnknown}: </b>${unknown}</li></#if>
<#if skipped != 0 ><li><b>${phrases.scenario.totalSkipped}: </b>${skipped}</li></#if>
</ul>

<#if suitesSummaryJson??>
<#assign suitesData = suitesSummaryJson?eval_json>
<b>${numberOfSuites}: </b>${suitesData.total}<br/>
<b>${phrases.numberOfSuites}: </b>${suitesData.total}<br/>
<#list suitesData.items as suite>
<#assign suitePassed = suite.statistic.passed>
<#assign suiteFailed = suite.statistic.failed>
Expand All @@ -25,17 +25,17 @@
<table style="border:1px solid black;">
<tr>
<td>
<b>${suiteName}: </b>${suite.name}<br/>
<b>${totalScenarios}: </b>${suite.statistic.total}<br/>
<#if suitePassed != 0 ><li><b>${totalPassed}: </b>${suitePassed}</li></#if>
<#if suiteFailed != 0 ><li><b>${totalFailed}: </b>${suiteFailed}</li></#if>
<#if suiteBroken != 0 ><li><b>${totalBroken}: </b>${suiteBroken}</li></#if>
<#if suiteUnknown != 0 ><li><b>${totalUnknown}: </b>${suiteUnknown}</li></#if>
<#if suiteSkipped != 0 ><li><b>${totalSkipped}: </b>${suiteSkipped}</li></#if>
<b>${phrases.suiteName}: </b>${suite.name}<br/>
<b>${phrases.scenario.totalScenarios}: </b>${suite.statistic.total}<br/>
<#if suitePassed != 0 ><li><b>${phrases.scenario.totalPassed}: </b>${suitePassed}</li></#if>
<#if suiteFailed != 0 ><li><b>${phrases.scenario.totalFailed}: </b>${suiteFailed}</li></#if>
<#if suiteBroken != 0 ><li><b>${phrases.scenario.totalBroken}: </b>${suiteBroken}</li></#if>
<#if suiteUnknown != 0 ><li><b>${phrases.scenario.totalUnknown}: </b>${suiteUnknown}</li></#if>
<#if suiteSkipped != 0 ><li><b>${phrases.scenario.totalSkipped}: </b>${suiteSkipped}</li></#if>
</td>
</tr>
</table><br/>
</#list>
</#if>
<#if reportLink??><b>${reportAvailableAtLink}:</b> <a href=${reportLink}>${reportLink}</a></#if>
<#if reportLink??><b>${phrases.reportAvailableAtLink}:</b> <a href=${reportLink}>${reportLink}</a></#if>
</#compress>
38 changes: 19 additions & 19 deletions allure-notifications-api/src/main/resources/templates/markdown.ftl
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<#compress>
*${results}:*
*${environment}:* ${env}
*${comment}:* ${comm}
*${duration}:* ${time}
*${totalScenarios}:* ${total}
<#if passed != 0 > *${totalPassed}:* ${passed} (${passedPercentage} %)</#if>
<#if failed != 0 > *${totalFailed}:* ${failed} (${failedPercentage} %)</#if>
<#if broken != 0 > *${totalBroken}:* ${broken} </#if>
<#if unknown != 0 >*${totalUnknown}:* ${unknown} </#if>
<#if skipped != 0 >*${totalSkipped}:* ${skipped} </#if>
*${phrases.results}:*
*${phrases.environment}:* ${env}
*${phrases.comment}:* ${comm}
*${phrases.scenario.duration}:* ${time}
*${phrases.scenario.totalScenarios}:* ${total}
<#if passed != 0 > *${phrases.scenario.totalPassed}:* ${passed} (${passedPercentage} %)</#if>
<#if failed != 0 > *${phrases.scenario.totalFailed}:* ${failed} (${failedPercentage} %)</#if>
<#if broken != 0 > *${phrases.scenario.totalBroken}:* ${broken} </#if>
<#if unknown != 0 >*${phrases.scenario.totalUnknown}:* ${unknown} </#if>
<#if skipped != 0 >*${phrases.scenario.totalSkipped}:* ${skipped} </#if>

<#if suitesSummaryJson??>
<#assign suitesData = suitesSummaryJson?eval_json>
*${numberOfSuites}:* ${suitesData.total}
*${phrases.numberOfSuites}:* ${suitesData.total}
<#list suitesData.items as suite>
<#assign suitePassed = suite.statistic.passed>
<#assign suiteFailed = suite.statistic.failed>
<#assign suiteBroken = suite.statistic.broken>
<#assign suiteUnknown = suite.statistic.unknown>
<#assign suiteSkipped = suite.statistic.skipped>

*${suiteName}:* ${suite.name}
> *${totalScenarios}:* ${suite.statistic.total}
<#if suitePassed != 0 >> *${totalPassed}:* ${suitePassed}</#if>
<#if suiteFailed != 0 >> *${totalFailed}:* ${suiteFailed}</#if>
<#if suiteBroken != 0 >> *${totalBroken}:* ${suiteBroken}</#if>
<#if suiteUnknown != 0 >> *${totalUnknown}:* ${suiteUnknown}</#if>
<#if suiteSkipped != 0 >> *${totalSkipped}:* ${suiteSkipped}</#if>
*${phrases.suiteName}:* ${suite.name}
> *${phrases.scenario.totalScenarios}:* ${suite.statistic.total}
<#if suitePassed != 0 >> *${phrases.scenario.totalPassed}:* ${suitePassed}</#if>
<#if suiteFailed != 0 >> *${phrases.scenario.totalFailed}:* ${suiteFailed}</#if>
<#if suiteBroken != 0 >> *${phrases.scenario.totalBroken}:* ${suiteBroken}</#if>
<#if suiteUnknown != 0 >> *${phrases.scenario.totalUnknown}:* ${suiteUnknown}</#if>
<#if suiteSkipped != 0 >> *${phrases.scenario.totalSkipped}:* ${suiteSkipped}</#if>
</#list>
</#if>
<#if reportLink??>*${reportAvailableAtLink}:* ${reportLink}</#if>
<#if reportLink??>*${phrases.reportAvailableAtLink}:* ${reportLink}</#if>
</#compress>
38 changes: 19 additions & 19 deletions allure-notifications-api/src/main/resources/templates/rocket.ftl
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<#compress>
**${results}:**
**-${environment}:** ${env}
**-${comment}:** ${comm}
**-${duration}:** **${time}**
**-${totalScenarios}:** ${total}
<#if passed != 0 > **-${totalPassed}:** ${passed} **(${passedPercentage} %)**</#if>
<#if failed != 0 > **-${totalFailed}:** ${failed} **(${failedPercentage} %)** </#if>
<#if broken != 0 > **-${totalBroken}:** ${broken} </#if>
<#if unknown != 0 > **-${totalUnknown}:** ${unknown} </#if>
<#if skipped != 0 > **-${totalSkipped}:** ${skipped} </#if>
**${phrases.results}:**
**-${phrases.environment}:** ${env}
**-${phrases.comment}:** ${comm}
**-${phrases.scenario.duration}:** **${time}**
**-${phrases.scenario.totalScenarios}:** ${total}
<#if passed != 0 > **-${phrases.scenario.totalPassed}:** ${passed} **(${passedPercentage} %)**</#if>
<#if failed != 0 > **-${phrases.scenario.totalFailed}:** ${failed} **(${failedPercentage} %)** </#if>
<#if broken != 0 > **-${phrases.scenario.totalBroken}:** ${broken} </#if>
<#if unknown != 0 > **-${phrases.scenario.totalUnknown}:** ${unknown} </#if>
<#if skipped != 0 > **-${phrases.scenario.totalSkipped}:** ${skipped} </#if>

<#if suitesSummaryJson??>
<#assign suitesData = suitesSummaryJson?eval_json>
**-${numberOfSuites}:** **${suitesData.total}**
**-${phrases.numberOfSuites}:** **${suitesData.total}**
<#list suitesData.items as suite>
<#assign suitePassed = suite.statistic.passed>
<#assign suiteFailed = suite.statistic.failed>
<#assign suiteBroken = suite.statistic.broken>
<#assign suiteUnknown = suite.statistic.unknown>
<#assign suiteSkipped = suite.statistic.skipped>

**-${suiteName}:** **${suite.name}**
**-${totalScenarios}:** **${suite.statistic.total}**
<#if suitePassed != 0 > **-${totalPassed}:** ${suitePassed}</#if>
<#if suiteFailed != 0 > **-${totalFailed}:** ${suiteFailed}</#if>
<#if suiteBroken != 0 > **-${totalBroken}:** ${suiteBroken}</#if>
<#if suiteUnknown != 0 > **-${totalUnknown}:** ${suiteUnknown}</#if>
<#if suiteSkipped != 0 > **-${totalSkipped}:** ${suiteSkipped}</#if>
**-${phrases.suiteName}:** **${suite.name}**
**-${phrases.scenario.totalScenarios}:** **${suite.statistic.total}**
<#if suitePassed != 0 > **-${phrases.scenario.totalPassed}:** ${suitePassed}</#if>
<#if suiteFailed != 0 > **-${phrases.scenario.totalFailed}:** ${suiteFailed}</#if>
<#if suiteBroken != 0 > **-${phrases.scenario.totalBroken}:** ${suiteBroken}</#if>
<#if suiteUnknown != 0 > **-${phrases.scenario.totalUnknown}:** ${suiteUnknown}</#if>
<#if suiteSkipped != 0 > **-${phrases.scenario.totalSkipped}:** ${suiteSkipped}</#if>
</#list>
</#if>
<#if reportLink??>**${reportAvailableAtLink}:** ${reportLink}</#if>
<#if reportLink??>**${phrases.reportAvailableAtLink}:** ${reportLink}</#if>
</#compress>
38 changes: 19 additions & 19 deletions allure-notifications-api/src/main/resources/templates/telegram.ftl
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<#compress>
<b>${results}:</b>
<b>${environment}: </b>${env}
<b>${comment}: </b>${comm}
<b>${duration}: </b>${time}
<b>${totalScenarios}: </b>${total}
<#if passed != 0 ><b>${totalPassed}: </b>${passed} (${passedPercentage} %)</#if>
<#if failed != 0 ><b>${totalFailed}: </b>${failed} (${failedPercentage} %)</#if>
<#if broken != 0 ><b>${totalBroken}: </b>${broken}</#if>
<#if unknown != 0 ><b>${totalUnknown}: </b>${unknown}</#if>
<#if skipped != 0 ><b>${totalSkipped}: </b>${skipped}</#if>
<b>${phrases.results}:</b>
<b>${phrases.environment}: </b>${env}
<b>${phrases.comment}: </b>${comm}
<b>${phrases.scenario.duration}: </b>${time}
<b>${phrases.scenario.totalScenarios}: </b>${total}
<#if passed != 0 ><b>${phrases.scenario.totalPassed}: </b>${passed} (${passedPercentage} %)</#if>
<#if failed != 0 ><b>${phrases.scenario.totalFailed}: </b>${failed} (${failedPercentage} %)</#if>
<#if broken != 0 ><b>${phrases.scenario.totalBroken}: </b>${broken}</#if>
<#if unknown != 0 ><b>${phrases.scenario.totalUnknown}: </b>${unknown}</#if>
<#if skipped != 0 ><b>${phrases.scenario.totalSkipped}: </b>${skipped}</#if>

<#if suitesSummaryJson??>
<#assign suitesData = suitesSummaryJson?eval_json>
<b>${numberOfSuites}: </b>${suitesData.total}
<b>${phrases.numberOfSuites}: </b>${suitesData.total}
<#list suitesData.items as suite>
<#assign suitePassed = suite.statistic.passed>
<#assign suiteFailed = suite.statistic.failed>
<#assign suiteBroken = suite.statistic.broken>
<#assign suiteUnknown = suite.statistic.unknown>
<#assign suiteSkipped = suite.statistic.skipped>

<b>${suiteName}: </b>${suite.name}
<code>${totalScenarios}: ${suite.statistic.total}</code>
<#if suitePassed != 0 ><code>${totalPassed}: ${suitePassed}</code></#if>
<#if suiteFailed != 0 ><code>${totalFailed}: ${suiteFailed}</code></#if>
<#if suiteBroken != 0 ><code>${totalBroken}: ${suiteBroken}</code></#if>
<#if suiteUnknown != 0 ><code>${totalUnknown}: ${suiteUnknown}</code></#if>
<#if suiteSkipped != 0 ><code>${totalSkipped}: ${suiteSkipped}</code></#if>
<b>${phrases.suiteName}: </b>${suite.name}
<code>${phrases.scenario.totalScenarios}: ${suite.statistic.total}</code>
<#if suitePassed != 0 ><code>${phrases.scenario.totalPassed}: ${suitePassed}</code></#if>
<#if suiteFailed != 0 ><code>${phrases.scenario.totalFailed}: ${suiteFailed}</code></#if>
<#if suiteBroken != 0 ><code>${phrases.scenario.totalBroken}: ${suiteBroken}</code></#if>
<#if suiteUnknown != 0 ><code>${phrases.scenario.totalUnknown}: ${suiteUnknown}</code></#if>
<#if suiteSkipped != 0 ><code>${phrases.scenario.totalSkipped}: ${suiteSkipped}</code></#if>
</#list>
</#if>
<#if reportLink??><b>${reportAvailableAtLink}:</b> <a href="${reportLink}">${reportLink}</a></#if>
<#if reportLink??><b>${phrases.reportAvailableAtLink}:</b> <a href="${reportLink}">${reportLink}</a></#if>
</#compress>

0 comments on commit 159844a

Please sign in to comment.