|
| 1 | +/* |
| 2 | + * |
| 3 | + * * Hibernate Search, full-text search for your domain model |
| 4 | + * * |
| 5 | + * * License: GNU Lesser General Public License (LGPL), version 2.1 or later |
| 6 | + * * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. |
| 7 | + * |
| 8 | + */ |
| 9 | +package org.hibernate.infra.bot.develocity; |
| 10 | + |
| 11 | +import static org.assertj.core.api.Assertions.assertThat; |
| 12 | + |
| 13 | +import java.net.URI; |
| 14 | +import java.util.List; |
| 15 | + |
| 16 | +import jakarta.inject.Inject; |
| 17 | + |
| 18 | +import org.junit.jupiter.api.Test; |
| 19 | + |
| 20 | +import io.quarkus.test.junit.QuarkusTest; |
| 21 | + |
| 22 | +@QuarkusTest |
| 23 | +class DevelocityReportFormatterTest { |
| 24 | + |
| 25 | + @Inject |
| 26 | + DevelocityReportFormatter formatter; |
| 27 | + |
| 28 | + @Test |
| 29 | + void summary_simple() { |
| 30 | + var buildScans = List.of( |
| 31 | + buildScanStub( "GitHub", "GitHub Actions Build", "", |
| 32 | + List.of( "Linux", "hibernate-search", "jdk-17", "main" ), |
| 33 | + List.of( "clean install" ), |
| 34 | + DevelocityCIBuildScan.Status.SUCCESS, |
| 35 | + DevelocityCIBuildScan.Status.SUCCESS ), |
| 36 | + buildScanStub( "GitHub", "GitHub Actions Build", "", |
| 37 | + List.of( "Linux", "elasticsearch", "elasticsearch-8.13", "h2", "hibernate-search", "jdk-17", "lucene", |
| 38 | + "main" ), |
| 39 | + List.of( "clean install" ), |
| 40 | + DevelocityCIBuildScan.Status.SUCCESS, |
| 41 | + DevelocityCIBuildScan.Status.SUCCESS ), |
| 42 | + buildScanStub( "GitHub", "GitHub Actions Build", "", |
| 43 | + List.of( "Windows Server 2022", "hibernate-search", "jdk-17", "main" ), |
| 44 | + List.of( "clean install" ), |
| 45 | + DevelocityCIBuildScan.Status.SUCCESS, |
| 46 | + DevelocityCIBuildScan.Status.SUCCESS ), |
| 47 | + buildScanStub( "GitHub", "GitHub Actions Build", "", |
| 48 | + List.of( "Windows Server 2022", "h2", "hibernate-search", "jdk-17", "lucene", "main" ), |
| 49 | + List.of( "clean install" ), |
| 50 | + DevelocityCIBuildScan.Status.SUCCESS, |
| 51 | + DevelocityCIBuildScan.Status.SUCCESS ), |
| 52 | + buildScanStub( "Jenkins", "hibernate-search/PR-4125", "Default build", |
| 53 | + List.of( "Linux", "hibernate-search", "jdk-17", "PR-4125" ), |
| 54 | + List.of( "clean install" ), |
| 55 | + DevelocityCIBuildScan.Status.SUCCESS, |
| 56 | + DevelocityCIBuildScan.Status.SUCCESS ), |
| 57 | + buildScanStub( "Jenkins", "hibernate-search/PR-4125", "Default build", |
| 58 | + List.of( "Linux", "elasticsearch", "elasticsearch-8.13", "h2", "hibernate-search", "jdk-17", "lucene" ), |
| 59 | + List.of( "clean verify" ), |
| 60 | + DevelocityCIBuildScan.Status.FAILURE, |
| 61 | + DevelocityCIBuildScan.Status.FAILURE ) |
| 62 | + ); |
| 63 | + assertThat( formatter.summary( buildScans ) ) |
| 64 | + .isEqualTo( """ |
| 65 | + | Status | Job/Workflow | Tags | Goals | Build Scan | Tests | Logs | |
| 66 | + | :-: | -- | -- | -- | :-: | :-: | :-: | |
| 67 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 68 | + |`GitHub Actions Build`\ |
| 69 | + |`Linux` `hibernate-search` `jdk-17` `main`\ |
| 70 | + |`clean install`\ |
| 71 | + |[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 72 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\ |
| 73 | + |[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\ |
| 74 | + | |
| 75 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 76 | + |`GitHub Actions Build`\ |
| 77 | + |`Linux` `elasticsearch` `elasticsearch-8.13` `h2` `hibernate-search` `jdk-17` `lucene` `main`\ |
| 78 | + |`clean install`\ |
| 79 | + |[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 80 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\ |
| 81 | + |[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\ |
| 82 | + | |
| 83 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 84 | + |`GitHub Actions Build`\ |
| 85 | + |`Windows Server 2022` `hibernate-search` `jdk-17` `main`\ |
| 86 | + |`clean install`\ |
| 87 | + |[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 88 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\ |
| 89 | + |[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\ |
| 90 | + | |
| 91 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 92 | + |`GitHub Actions Build`\ |
| 93 | + |`Windows Server 2022` `h2` `hibernate-search` `jdk-17` `lucene` `main`\ |
| 94 | + |`clean install`\ |
| 95 | + |[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 96 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\ |
| 97 | + |[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\ |
| 98 | + | |
| 99 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 100 | + |`hibernate-search/PR-4125 Default build`\ |
| 101 | + |`Linux` `hibernate-search` `jdk-17` `PR-4125`\ |
| 102 | + |`clean install`\ |
| 103 | + |[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 104 | + |[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\ |
| 105 | + |[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\ |
| 106 | + | |
| 107 | + |[:x:](https://ge.hibernate.org/s/45fv2rr67ofuy/failures)\ |
| 108 | + |`hibernate-search/PR-4125 Default build`\ |
| 109 | + |`Linux` `elasticsearch` `elasticsearch-8.13` `h2` `hibernate-search` `jdk-17` `lucene`\ |
| 110 | + |`clean verify`\ |
| 111 | + |[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\ |
| 112 | + |[:x:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\ |
| 113 | + |[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\ |
| 114 | + | |
| 115 | + """ ); |
| 116 | + } |
| 117 | + |
| 118 | + private DevelocityCIBuildScan buildScanStub(String provider, String jobOrWorkflow, String stage, List<String> tags, |
| 119 | + List<String> goals, DevelocityCIBuildScan.Status status, DevelocityCIBuildScan.Status testStatus) { |
| 120 | + return new DevelocityCIBuildScan( provider, jobOrWorkflow, stage, 0L, |
| 121 | + tags, goals, status, testStatus, |
| 122 | + URI.create( "https://ge.hibernate.org/s/45fv2rr67ofuy" ), |
| 123 | + URI.create( "https://ge.hibernate.org/s/45fv2rr67ofuy/failures" ), |
| 124 | + URI.create( "https://ge.hibernate.org/s/45fv2rr67ofuy/tests" ), |
| 125 | + URI.create( "https://ge.hibernate.org/s/45fv2rr67ofuy/console-log" ) ); |
| 126 | + } |
| 127 | + |
| 128 | +} |
0 commit comments