mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-29 15:44:14 +00:00
issue_863: Removed testng from codebase. Has been officially replaced with spring junit.
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled
This commit is contained in:
parent
e49f7fd5ce
commit
616fc0686f
@ -22,7 +22,6 @@ protobufJavaVersion = "4.28.3"
|
||||
springBootVersion = "3.4.0"
|
||||
springCoreVersion = "6.2.1"
|
||||
springRetryVersion = "2.0.10"
|
||||
testngVersion = "7.10.2"
|
||||
tomcatVersion = "10.1.33"
|
||||
|
||||
#test dependencies versions
|
||||
@ -60,7 +59,6 @@ spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-start
|
||||
spring-framework-webmvc = { module = "org.springframework:spring-webmvc", version.ref = "springCoreVersion" }
|
||||
spring-retry = { module = "org.springframework.retry:spring-retry", version.ref = "springRetryVersion" }
|
||||
tomcat-embed-jasper = { module = "org.apache.tomcat.embed:tomcat-embed-jasper", version.ref = "tomcatVersion" }
|
||||
testng = { module = "org.testng:testng", version.ref = "testngVersion" }
|
||||
|
||||
# test dependencies
|
||||
hsqldb = { module = "org.hsqldb:hsqldb", version.ref = "hsqldbVersion" }
|
||||
|
@ -25,7 +25,7 @@ dependencies {
|
||||
compileOnly libs.lombok
|
||||
annotationProcessor libs.lombok
|
||||
|
||||
testImplementation libs.testng
|
||||
testImplementation libs.spring.boot.starter.test
|
||||
|
||||
testCompileOnly libs.lombok
|
||||
testAnnotationProcessor libs.lombok
|
||||
|
@ -1,20 +1,19 @@
|
||||
package hirs.swid;
|
||||
|
||||
import hirs.utils.rim.ReferenceManifestValidator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.test.context.event.annotation.AfterTestClass;
|
||||
import org.springframework.test.context.event.annotation.BeforeTestClass;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
||||
public class TestSwidTagGateway {
|
||||
private SwidTagGateway gateway;
|
||||
private ReferenceManifestValidator validator;
|
||||
private final String DEFAULT_OUTPUT = "generated_swidTag.swidtag";
|
||||
private final String BASE_USER_CERT = "generated_user_cert.swidtag";
|
||||
private final String BASE_USER_CERT_EMBED = "generated_user_cert_embed.swidtag";
|
||||
@ -35,9 +34,11 @@ public class TestSwidTagGateway {
|
||||
.getResource("TpmLog.bin").getPath();
|
||||
private final String RFC3852_COUNTERSIGNATURE_FILE = TestSwidTagGateway.class.getClassLoader()
|
||||
.getResource("counterSignature.file").getPath();
|
||||
private SwidTagGateway gateway;
|
||||
private ReferenceManifestValidator validator;
|
||||
private InputStream expectedFile;
|
||||
|
||||
@BeforeClass
|
||||
@BeforeTestClass
|
||||
public void setUp() throws Exception {
|
||||
gateway = new SwidTagGateway();
|
||||
gateway.setRimEventLog(SUPPORT_RIM_FILE);
|
||||
@ -47,7 +48,7 @@ public class TestSwidTagGateway {
|
||||
validator.setTrustStoreFile(CA_CHAIN_FILE);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterTestClass
|
||||
public void tearDown() throws Exception {
|
||||
if (expectedFile != null) {
|
||||
expectedFile.close();
|
||||
@ -68,9 +69,9 @@ public class TestSwidTagGateway {
|
||||
gateway.generateSwidTag(DEFAULT_OUTPUT);
|
||||
expectedFile = TestSwidTagGateway.class.getClassLoader()
|
||||
.getResourceAsStream(BASE_USER_CERT);
|
||||
Assert.assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
validator.setRim(DEFAULT_OUTPUT);
|
||||
Assert.assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,9 +89,9 @@ public class TestSwidTagGateway {
|
||||
gateway.generateSwidTag(DEFAULT_OUTPUT);
|
||||
expectedFile = TestSwidTagGateway.class.getClassLoader()
|
||||
.getResourceAsStream(BASE_USER_CERT_EMBED);
|
||||
Assert.assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
validator.setRim(DEFAULT_OUTPUT);
|
||||
Assert.assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,9 +105,9 @@ public class TestSwidTagGateway {
|
||||
gateway.generateSwidTag(DEFAULT_OUTPUT);
|
||||
expectedFile = TestSwidTagGateway.class.getClassLoader()
|
||||
.getResourceAsStream(BASE_DEFAULT_CERT);
|
||||
Assert.assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
validator.setRim(DEFAULT_OUTPUT);
|
||||
Assert.assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,9 +123,9 @@ public class TestSwidTagGateway {
|
||||
gateway.generateSwidTag(DEFAULT_OUTPUT);
|
||||
expectedFile = TestSwidTagGateway.class.getClassLoader()
|
||||
.getResourceAsStream(BASE_RFC3339_TIMESTAMP);
|
||||
Assert.assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
validator.setRim(DEFAULT_OUTPUT);
|
||||
Assert.assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,9 +141,9 @@ public class TestSwidTagGateway {
|
||||
gateway.generateSwidTag(DEFAULT_OUTPUT);
|
||||
expectedFile = TestSwidTagGateway.class.getClassLoader()
|
||||
.getResourceAsStream(BASE_RFC3852_TIMESTAMP);
|
||||
Assert.assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
assertTrue(compareFileBytesToExpectedFile(DEFAULT_OUTPUT));
|
||||
validator.setRim(DEFAULT_OUTPUT);
|
||||
Assert.assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,11 +156,12 @@ public class TestSwidTagGateway {
|
||||
.getResource(BASE_USER_CERT).getPath();
|
||||
System.out.println("Validating file at " + filepath);
|
||||
validator.setRim(DEFAULT_OUTPUT);
|
||||
Assert.assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
assertTrue(validator.validateRim(SIGNING_CERT_FILE));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method compares two files by bytes to determine if they are the same or not.
|
||||
*
|
||||
* @param file to be compared to the expected value.
|
||||
* @return true if they are equal, false if not.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user