Skip to content
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

feat: Initial version of HTML report generation for single scan #573

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
</properties>

<dependencies>
<dependency>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check solution with 'ConfigurableApplicationContext'

<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand Down Expand Up @@ -129,6 +134,10 @@
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
61 changes: 34 additions & 27 deletions src/main/java/com/lpvs/LicensePreValidationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
package com.lpvs;

import lombok.extern.slf4j.Slf4j;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
Expand All @@ -19,6 +21,8 @@

import com.lpvs.util.LPVSExitHandler;

import java.io.FileReader;

/**
* The main class for the License Pre-Validation Service (LPVS) application.
* This class configures and launches the LPVS Spring Boot application.
Expand Down Expand Up @@ -74,6 +78,21 @@ public static void main(String[] args) {
}
}

/**
* Retrieves the version of the LicensePreValidationService using the provided MavenXpp3Reader object.
*
* @param reader the MavenXpp3Reader object used to read the pom.xml file
* @return the version of the LicensePreValidationService, or "latest" if an error occurs
*/
public static String getVersion(MavenXpp3Reader reader) {
try (FileReader fileReader = new FileReader("pom.xml")) {
Model model = reader.read(fileReader);
return model.getVersion();
} catch (Exception e) {
return "latest";
}
}

/**
* Configures and retrieves an asynchronous task executor bean.
*
Expand All @@ -93,32 +112,20 @@ public TaskExecutor getAsyncExecutor() {
* @return the emblem as a String
*/
protected static String getEmblem() {
StringBuilder emblem = new StringBuilder();
emblem.append("\n");
emblem.append(
" .----------------. .----------------. .----------------. .----------------. \n");
emblem.append(
" | .--------------. | | .--------------. | | .--------------. | | .--------------. |\n");
emblem.append(
" | | _____ | | | | ______ | | | | ____ ____ | | | | _______ | |\n");
emblem.append(
" | | |_ _| | | | | |_ __ \\ | | | ||_ _| |_ _| | | | | / ___ | | |\n");
emblem.append(
" | | | | | | | | | |__) | | | | | \\ \\ / / | | | | | (__ \\_| | |\n");
emblem.append(
" | | | | _ | | | | | ___/ | | | | \\ \\ / / | | | | '.___`-. | |\n");
emblem.append(
" | | _| |__/ | | | | | _| |_ | | | | \\ ' / | | | | |`\\____) | | |\n");
emblem.append(
" | | |________| | | | | |_____| | | | | \\_/ | | | | |_______.' | |\n");
emblem.append(
" | | | | | | | | | | | | | | | |\n");
emblem.append(
" | '--------------' | | '--------------' | | '--------------' | | '--------------' |\n");
emblem.append(
" '----------------' '----------------' '----------------' '----------------' \n");
emblem.append(
" :: License Pre-Validation Service :: (v1.5.2)\n");
return emblem.toString();
return "\n"
+ " .----------------. .----------------. .----------------. .----------------. \n"
+ " | .--------------. | | .--------------. | | .--------------. | | .--------------. |\n"
+ " | | _____ | | | | ______ | | | | ____ ____ | | | | _______ | |\n"
+ " | | |_ _| | | | | |_ __ \\ | | | ||_ _| |_ _| | | | | / ___ | | |\n"
+ " | | | | | | | | | |__) | | | | | \\ \\ / / | | | | | (__ \\_| | |\n"
+ " | | | | _ | | | | | ___/ | | | | \\ \\ / / | | | | '.___`-. | |\n"
+ " | | _| |__/ | | | | | _| |_ | | | | \\ ' / | | | | |`\\____) | | |\n"
+ " | | |________| | | | | |_____| | | | | \\_/ | | | | |_______.' | |\n"
+ " | | | | | | | | | | | | | | | |\n"
+ " | '--------------' | | '--------------' | | '--------------' | | '--------------' |\n"
+ " '----------------' '----------------' '----------------' '----------------' \n"
+ " :: License Pre-Validation Service :: ("
+ getVersion(new MavenXpp3Reader())
+ ")\n";
}
}
Loading
Loading