Skip to content

[#874] WIP: Checkstyle changes for tcg_rim_tool #900

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/dotnet_provisioner_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
run: |
mkdir artifacts

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: artifacts

Expand All @@ -133,4 +133,4 @@ jobs:
if [ -n "$result" ]
then
exit 1
fi
fi
4 changes: 2 additions & 2 deletions .github/workflows/hirs_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
fi; popd;'
# Upload build report files
- name: Archive report files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: HIRS_Build_Reports
path: artifacts/upload_reports/*
Expand All @@ -95,4 +95,4 @@ jobs:
uses: actions/github-script@v6
with:
script: |
core.setFailed('Build or Unit Test Failed')
core.setFailed('Build or Unit Test Failed')
11 changes: 3 additions & 8 deletions HIRS_AttestationCA/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ plugins {
}

configurations {
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compileOnly {
extendsFrom annotationProcessor
}
Expand Down Expand Up @@ -38,23 +41,15 @@ dependencies {
// explicitly include the patched version of the spring framework webmvc dependency
implementation libs.spring.framework.webmvc

// explicitly include the patched version of the logback-core dependency
implementation libs.logback.classic

compileOnly libs.lombok
annotationProcessor libs.lombok

compileOnly libs.spotbugs.annotations
annotationProcessor libs.spotbugs.annotations

testImplementation libs.commons.io

// explicitly include the patched version of the logback-core dependency
testImplementation libs.logback.classic

testImplementation libs.spring.boot.starter.test


testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public ComponentClass(final String registryOid,
* @param component string representation of the component ID
* @return the int representation of the component
*/
private static String verifyComponentValue(final String component) {
private String verifyComponentValue(final String component) {
String componentValue = ERROR;

if (component != null) {
Expand Down Expand Up @@ -223,7 +223,7 @@ private void findStringValues(final JsonObject categories) {
} else if (componentMask.equals(UNKNOWN)) {
this.componentStr = UNKNOWN_STRING;
} else {
getComponent(componentTypes);
setComponentString(componentTypes);
}
}
}
Expand All @@ -247,12 +247,11 @@ public boolean categoryMatch(final String category, final String componentId) {
}

/**
* Getter for the component associated with the component JSON Object mapped
* in the JSON file.
* Sets the component string value based on the provided JSON object's components.
*
* @param components JSON Object for the categories components
* @param components JSON Object components
*/
private void getComponent(final JsonObject components) {
private void setComponentString(final JsonObject components) {
String typeID;

if (components != null) {
Expand All @@ -264,5 +263,10 @@ private void getComponent(final JsonObject components) {
}
}
}

// if the component string is still null after doing a lookup
if (componentStr == null) {
componentStr = UNKNOWN_STRING;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.nio.file.Paths;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
* Tests for the ComponentClassTest class.
Expand All @@ -28,8 +28,8 @@ public void testGetComponentNoneUNK() throws URISyntaxException {
componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "Unknown");
assertEquals(resultCategory, "None");
assertEquals("Unknown", resultComponent);
assertEquals("None", resultCategory);
}

/**
Expand All @@ -44,8 +44,8 @@ public void testGetComponentNoneOther() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "Unknown");
assertEquals(resultCategory, "None");
assertEquals("Unknown", resultComponent);
assertEquals("None", resultCategory);
}

/**
Expand All @@ -60,8 +60,8 @@ public void testGetComponentBlank() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "Unknown");
assertEquals(resultCategory, "None");
assertEquals("Unknown", resultComponent);
assertEquals("None", resultCategory);
}

/**
Expand All @@ -76,8 +76,8 @@ public void testGetComponentNFEx() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "Unknown");
assertEquals(resultCategory, "None");
assertEquals("Unknown", resultComponent);
assertEquals("None", resultCategory);
}

/**
Expand All @@ -92,8 +92,8 @@ public void testGetComponentNull() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "Unknown");
assertEquals(resultCategory, "None");
assertEquals("Unknown", resultComponent);
assertEquals("None", resultCategory);
}

/**
Expand All @@ -108,8 +108,8 @@ public void testGetComponentStandardQueryTCG() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "SAS Bridgeboard");
assertEquals(resultCategory, "Modules");
assertEquals("SAS Bridgeboard", resultComponent);
assertEquals("Modules", resultCategory);
}

/**
Expand Down Expand Up @@ -140,8 +140,8 @@ public void testGetComponentStandardQueryIntTCG() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "SAS Bridgeboard");
assertEquals(resultCategory, "Modules");
assertEquals("SAS Bridgeboard", resultComponent);
assertEquals("Modules", resultCategory);
}

/**
Expand Down Expand Up @@ -236,8 +236,8 @@ public void testGetComponentNonStandardQuery() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "SAS Bridgeboard");
assertEquals(resultCategory, "Modules");
assertEquals("SAS Bridgeboard", resultComponent);
assertEquals("Modules", resultCategory);
}

/**
Expand All @@ -252,8 +252,8 @@ public void testGetComponentNonStandardQuery2() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "SAS Bridgeboard");
assertEquals(resultCategory, "Modules");
assertEquals("SAS Bridgeboard", resultComponent);
assertEquals("Modules", resultCategory);
}

/**
Expand All @@ -268,8 +268,9 @@ public void testGetComponentNonExistentValue() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertNull(resultComponent);
assertEquals(resultCategory, "Modules");
assertNotNull(resultComponent);
assertEquals("Unknown", resultComponent);
assertEquals("Modules", resultCategory);
}

/**
Expand All @@ -284,8 +285,9 @@ public void testGetComponentNonExistentValue2() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertNull(resultComponent);
assertEquals(resultCategory, "Modules");
assertNotNull(resultComponent);
assertEquals("Unknown", resultComponent);
assertEquals("Modules", resultCategory);
}

/**
Expand All @@ -300,7 +302,7 @@ public void testGetComponentNonExistentCategory() throws URISyntaxException {
.getResource(JSON_FILE).toURI()), componentIdentifier);
String resultCategory = instance.getCategoryStr();
String resultComponent = instance.getComponentStr();
assertEquals(resultComponent, "Unknown");
assertEquals(resultCategory, "None");
assertEquals("Unknown", resultComponent);
assertEquals("None", resultCategory);
}
}
4 changes: 3 additions & 1 deletion HIRS_AttestationCAPortal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ bootRun {
}

configurations {
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compileOnly {
extendsFrom annotationProcessor
}
all*.exclude module: 'spring-boot-starter-logging'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package hirs.attestationca.portal.page;

import hirs.utils.VersionHelper;
import lombok.Getter;

/**
* Contains attributes required to display a portal page and its menu link.
*/
@Getter
public enum Page {

/**
Expand Down Expand Up @@ -73,14 +75,25 @@ public enum Page {
HELP("Help", "ic_live_help");

private final String title;

private final String subtitle;

private final String icon;

/**
* Boolean representation of whether the page should display the navigation menu.
*/
private final boolean hasMenu;

private final String menuLinkClass;

/**
* Boolean representation of whether the page should be displayed in the navigation menu.
*/
private final boolean inMenu;

private final String prefixPath;

private final String viewName;

/**
Expand Down Expand Up @@ -150,80 +163,4 @@ public enum Page {
final String icon) {
this(title, null, icon, true, true, null, null);
}

/**
* Returns the title of the page.
*
* @return the title of the page.
*/
public String getTitle() {
return title;
}

/**
* Returns the subtitle of the page.
*
* @return the subtitle of the page.
*/
public String getSubtitle() {
return subtitle;
}

/**
* Returns the base filename of the icon for page. E.g. "ic_my_icon", which will be appended
* with appropriate size string (_24dp/_48dp) and file extension (.png) when used.
*
* @return the base filename of the icon for page.
*/
public String getIcon() {
return icon;
}

/**
* Returns true if the page should be displayed in the navigation menu.
*
* @return true if the page should be displayed in the navigation menu.
*/
public boolean getInMenu() {
return inMenu;
}

/**
* Returns the css class to add to the menu link to display it appropriately. E.g. "first" if
* the link is the first in a group to separate it visually from the previous group.
*
* @return he class to add to the menu link to display it appropriately.
*/
public String getMenuLinkClass() {
return menuLinkClass;
}

/**
* Returns true if the page should display the navigation menu.
*
* @return true if the page should display the navigation menu.
*/
public boolean getHasMenu() {
return hasMenu;
}

/**
* Return the page's view name.
*
* @return the page's view name
*/
public String getViewName() {
return viewName;
}

/**
* Return the page's view name.
*
* @return the page's view name
*/
public String getPrefixPath() {
return prefixPath;
}

}

Loading
Loading