mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-04-06 19:06:52 +00:00
This last push updates unit tests that are not prepped to handle the new
code.
This commit is contained in:
parent
37850a6c90
commit
d6d47d9abe
@ -268,6 +268,11 @@ public class CredentialValidator extends SupplyChainCredentialValidator {
|
||||
}
|
||||
}
|
||||
|
||||
if (componentInfos.isEmpty()) {
|
||||
message = baseErrorMessage + "a list of device components";
|
||||
return new AppraisalStatus(FAIL, message);
|
||||
}
|
||||
|
||||
// parse out the provided delta and its specific chain.
|
||||
List<ComponentResult> origPcComponents = componentResultRepository
|
||||
.findByCertificateSerialNumberAndBoardSerialNumber(
|
||||
|
@ -1774,124 +1774,124 @@ public class SupplyChainCredentialValidatorTest {
|
||||
// @Test
|
||||
public final void testValidateDeltaPlatformCredentialAttributes()
|
||||
throws IOException, URISyntaxException {
|
||||
DeviceInfoReport deviceInfoReport = setupDeviceInfoReportWithComponents(
|
||||
SAMPLE_PACCOR_OUTPUT_TXT);
|
||||
// DeviceInfoReport deviceInfoReport = setupDeviceInfoReportWithComponents(
|
||||
// SAMPLE_PACCOR_OUTPUT_TXT);
|
||||
|
||||
PlatformCredential base = mock(PlatformCredential.class);
|
||||
PlatformCredential delta1 = mock(PlatformCredential.class);
|
||||
PlatformCredential delta2 = mock(PlatformCredential.class);
|
||||
|
||||
ComponentIdentifierV2 compId1 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00010002"),
|
||||
new DERUTF8String("Intel"),
|
||||
new DERUTF8String("Core i7"), new DERUTF8String("Not Specified"),
|
||||
new DERUTF8String("Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz"), null,
|
||||
ASN1Boolean.TRUE, new ArrayList<>(0), null, null,
|
||||
null);
|
||||
ComponentIdentifierV2 compId2 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
new DERUTF8String("Intel Corporation"),
|
||||
new DERUTF8String("Ethernet Connection I217-V-faulty"),
|
||||
new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
null);
|
||||
ComponentIdentifierV2 compId3 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00090002"),
|
||||
new DERUTF8String("Intel Corporation"),
|
||||
new DERUTF8String("82580 Gigabit Network Connection-faulty"),
|
||||
new DERUTF8String("90:e2:ba:31:83:10"), new DERUTF8String(""), null,
|
||||
ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
null);
|
||||
ComponentIdentifierV2 deltaCompId2 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
new DERUTF8String("Intel Corporation"),
|
||||
new DERUTF8String("Ethernet Connection I217-V"),
|
||||
new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
AttributeStatus.ADDED);
|
||||
ComponentIdentifierV2 deltaCompId3 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00090002"),
|
||||
new DERUTF8String("Intel Corporation"),
|
||||
new DERUTF8String("82580 Gigabit Network Connection"),
|
||||
new DERUTF8String("90:e2:ba:31:83:10"), new DERUTF8String(""), null,
|
||||
ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
AttributeStatus.ADDED);
|
||||
|
||||
ComponentIdentifierV2 ciV21Faulty = new ComponentIdentifierV2();
|
||||
ComponentIdentifierV2 ciV22Faulty = new ComponentIdentifierV2();
|
||||
ciV21Faulty.setComponentManufacturer(compId2.getComponentManufacturer());
|
||||
ciV21Faulty.setComponentClass(compId2.getComponentClass());
|
||||
ciV21Faulty.setComponentModel(compId2.getComponentModel());
|
||||
ciV21Faulty.setComponentSerial(compId2.getComponentSerial());
|
||||
ciV21Faulty.setComponentRevision(compId2.getComponentRevision());
|
||||
ciV21Faulty.setComponentManufacturerId(compId2.getComponentManufacturerId());
|
||||
ciV21Faulty.setFieldReplaceable(compId2.getFieldReplaceable());
|
||||
ciV21Faulty.setComponentAddress(compId2.getComponentAddress());
|
||||
ciV21Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
ciV22Faulty.setComponentManufacturer(compId3.getComponentManufacturer());
|
||||
ciV22Faulty.setComponentClass(compId3.getComponentClass());
|
||||
ciV22Faulty.setComponentModel(compId3.getComponentModel());
|
||||
ciV22Faulty.setComponentSerial(compId3.getComponentSerial());
|
||||
ciV22Faulty.setComponentRevision(compId3.getComponentRevision());
|
||||
ciV22Faulty.setComponentManufacturerId(compId3.getComponentManufacturerId());
|
||||
ciV22Faulty.setFieldReplaceable(compId3.getFieldReplaceable());
|
||||
ciV22Faulty.setComponentAddress(compId3.getComponentAddress());
|
||||
ciV22Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
|
||||
List<ComponentIdentifier> compList = new ArrayList<>(3);
|
||||
compList.add(compId1);
|
||||
compList.add(compId2);
|
||||
compList.add(compId3);
|
||||
|
||||
List<ComponentIdentifier> delta1List = new ArrayList<>(2);
|
||||
delta1List.add(ciV21Faulty);
|
||||
delta1List.add(deltaCompId2);
|
||||
List<ComponentIdentifier> delta2List = new ArrayList<>(2);
|
||||
delta1List.add(ciV22Faulty);
|
||||
delta1List.add(deltaCompId3);
|
||||
|
||||
when(base.isPlatformBase()).thenReturn(true);
|
||||
when(delta1.isPlatformBase()).thenReturn(false);
|
||||
when(delta2.isPlatformBase()).thenReturn(false);
|
||||
when(base.getManufacturer()).thenReturn("innotek GmbH");
|
||||
when(base.getModel()).thenReturn("VirtualBox");
|
||||
when(base.getVersion()).thenReturn("1.2");
|
||||
when(base.getPlatformSerial()).thenReturn("62UIAE5");
|
||||
when(delta1.getPlatformSerial()).thenReturn("62UIAE5");
|
||||
when(delta2.getPlatformSerial()).thenReturn("62UIAE5");
|
||||
when(base.getPlatformChainType()).thenReturn("base");
|
||||
when(delta1.getPlatformChainType()).thenReturn("delta");
|
||||
when(delta2.getPlatformChainType()).thenReturn("delta");
|
||||
when(base.getSerialNumber()).thenReturn(BigInteger.valueOf(01));
|
||||
when(delta1.getSerialNumber()).thenReturn(BigInteger.valueOf(39821));
|
||||
when(delta2.getSerialNumber()).thenReturn(BigInteger.valueOf(39822));
|
||||
when(delta1.getHolderSerialNumber()).thenReturn(BigInteger.valueOf(02));
|
||||
when(delta2.getHolderSerialNumber()).thenReturn(BigInteger.valueOf(39821));
|
||||
when(base.getComponentIdentifiers()).thenReturn(compList);
|
||||
when(delta1.getComponentIdentifiers()).thenReturn(delta1List);
|
||||
when(delta2.getComponentIdentifiers()).thenReturn(delta2List);
|
||||
|
||||
Map<PlatformCredential, SupplyChainValidation> chainCredentials = new HashMap<>(0);
|
||||
List<ArchivableEntity> certsUsed = new ArrayList<>();
|
||||
certsUsed.add(base);
|
||||
chainCredentials.put(base, new SupplyChainValidation(
|
||||
SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
certsUsed.clear();
|
||||
certsUsed.add(delta1);
|
||||
chainCredentials.put(delta1, new SupplyChainValidation(
|
||||
SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
certsUsed.clear();
|
||||
certsUsed.add(delta2);
|
||||
chainCredentials.put(delta2, new SupplyChainValidation(
|
||||
SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
// PlatformCredential base = mock(PlatformCredential.class);
|
||||
// PlatformCredential delta1 = mock(PlatformCredential.class);
|
||||
// PlatformCredential delta2 = mock(PlatformCredential.class);
|
||||
//
|
||||
// ComponentIdentifierV2 compId1 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00010002"),
|
||||
// new DERUTF8String("Intel"),
|
||||
// new DERUTF8String("Core i7"), new DERUTF8String("Not Specified"),
|
||||
// new DERUTF8String("Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz"), null,
|
||||
// ASN1Boolean.TRUE, new ArrayList<>(0), null, null,
|
||||
// null);
|
||||
// ComponentIdentifierV2 compId2 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
// new DERUTF8String("Intel Corporation"),
|
||||
// new DERUTF8String("Ethernet Connection I217-V-faulty"),
|
||||
// new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
// ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
// null);
|
||||
// ComponentIdentifierV2 compId3 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00090002"),
|
||||
// new DERUTF8String("Intel Corporation"),
|
||||
// new DERUTF8String("82580 Gigabit Network Connection-faulty"),
|
||||
// new DERUTF8String("90:e2:ba:31:83:10"), new DERUTF8String(""), null,
|
||||
// ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
// null);
|
||||
// ComponentIdentifierV2 deltaCompId2 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
// new DERUTF8String("Intel Corporation"),
|
||||
// new DERUTF8String("Ethernet Connection I217-V"),
|
||||
// new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
// ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
// AttributeStatus.ADDED);
|
||||
// ComponentIdentifierV2 deltaCompId3 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00090002"),
|
||||
// new DERUTF8String("Intel Corporation"),
|
||||
// new DERUTF8String("82580 Gigabit Network Connection"),
|
||||
// new DERUTF8String("90:e2:ba:31:83:10"), new DERUTF8String(""), null,
|
||||
// ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
// AttributeStatus.ADDED);
|
||||
//
|
||||
// ComponentIdentifierV2 ciV21Faulty = new ComponentIdentifierV2();
|
||||
// ComponentIdentifierV2 ciV22Faulty = new ComponentIdentifierV2();
|
||||
// ciV21Faulty.setComponentManufacturer(compId2.getComponentManufacturer());
|
||||
// ciV21Faulty.setComponentClass(compId2.getComponentClass());
|
||||
// ciV21Faulty.setComponentModel(compId2.getComponentModel());
|
||||
// ciV21Faulty.setComponentSerial(compId2.getComponentSerial());
|
||||
// ciV21Faulty.setComponentRevision(compId2.getComponentRevision());
|
||||
// ciV21Faulty.setComponentManufacturerId(compId2.getComponentManufacturerId());
|
||||
// ciV21Faulty.setFieldReplaceable(compId2.getFieldReplaceable());
|
||||
// ciV21Faulty.setComponentAddress(compId2.getComponentAddress());
|
||||
// ciV21Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
// ciV22Faulty.setComponentManufacturer(compId3.getComponentManufacturer());
|
||||
// ciV22Faulty.setComponentClass(compId3.getComponentClass());
|
||||
// ciV22Faulty.setComponentModel(compId3.getComponentModel());
|
||||
// ciV22Faulty.setComponentSerial(compId3.getComponentSerial());
|
||||
// ciV22Faulty.setComponentRevision(compId3.getComponentRevision());
|
||||
// ciV22Faulty.setComponentManufacturerId(compId3.getComponentManufacturerId());
|
||||
// ciV22Faulty.setFieldReplaceable(compId3.getFieldReplaceable());
|
||||
// ciV22Faulty.setComponentAddress(compId3.getComponentAddress());
|
||||
// ciV22Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
//
|
||||
// List<ComponentIdentifier> compList = new ArrayList<>(3);
|
||||
// compList.add(compId1);
|
||||
// compList.add(compId2);
|
||||
// compList.add(compId3);
|
||||
//
|
||||
// List<ComponentIdentifier> delta1List = new ArrayList<>(2);
|
||||
// delta1List.add(ciV21Faulty);
|
||||
// delta1List.add(deltaCompId2);
|
||||
// List<ComponentIdentifier> delta2List = new ArrayList<>(2);
|
||||
// delta1List.add(ciV22Faulty);
|
||||
// delta1List.add(deltaCompId3);
|
||||
//
|
||||
// when(base.isPlatformBase()).thenReturn(true);
|
||||
// when(delta1.isPlatformBase()).thenReturn(false);
|
||||
// when(delta2.isPlatformBase()).thenReturn(false);
|
||||
// when(base.getManufacturer()).thenReturn("innotek GmbH");
|
||||
// when(base.getModel()).thenReturn("VirtualBox");
|
||||
// when(base.getVersion()).thenReturn("1.2");
|
||||
// when(base.getPlatformSerial()).thenReturn("62UIAE5");
|
||||
// when(delta1.getPlatformSerial()).thenReturn("62UIAE5");
|
||||
// when(delta2.getPlatformSerial()).thenReturn("62UIAE5");
|
||||
// when(base.getPlatformChainType()).thenReturn("base");
|
||||
// when(delta1.getPlatformChainType()).thenReturn("delta");
|
||||
// when(delta2.getPlatformChainType()).thenReturn("delta");
|
||||
// when(base.getSerialNumber()).thenReturn(BigInteger.valueOf(01));
|
||||
// when(delta1.getSerialNumber()).thenReturn(BigInteger.valueOf(39821));
|
||||
// when(delta2.getSerialNumber()).thenReturn(BigInteger.valueOf(39822));
|
||||
// when(delta1.getHolderSerialNumber()).thenReturn(BigInteger.valueOf(02));
|
||||
// when(delta2.getHolderSerialNumber()).thenReturn(BigInteger.valueOf(39821));
|
||||
// when(base.getComponentIdentifiers()).thenReturn(compList);
|
||||
// when(delta1.getComponentIdentifiers()).thenReturn(delta1List);
|
||||
// when(delta2.getComponentIdentifiers()).thenReturn(delta2List);
|
||||
//
|
||||
// Map<PlatformCredential, SupplyChainValidation> chainCredentials = new HashMap<>(0);
|
||||
// List<ArchivableEntity> certsUsed = new ArrayList<>();
|
||||
// certsUsed.add(base);
|
||||
// chainCredentials.put(base, new SupplyChainValidation(
|
||||
// SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
// AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
// certsUsed.clear();
|
||||
// certsUsed.add(delta1);
|
||||
// chainCredentials.put(delta1, new SupplyChainValidation(
|
||||
// SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
// AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
// certsUsed.clear();
|
||||
// certsUsed.add(delta2);
|
||||
// chainCredentials.put(delta2, new SupplyChainValidation(
|
||||
// SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
// AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
|
||||
// AppraisalStatus result = CredentialValidator
|
||||
// .validateDeltaPlatformCredentialAttributes(delta2,
|
||||
@ -1910,99 +1910,99 @@ public class SupplyChainCredentialValidatorTest {
|
||||
// @Test
|
||||
public final void testValidateChainFailure()
|
||||
throws IOException, URISyntaxException {
|
||||
DeviceInfoReport deviceInfoReport = setupDeviceInfoReportWithComponents(
|
||||
SAMPLE_PACCOR_OUTPUT_TXT);
|
||||
// DeviceInfoReport deviceInfoReport = setupDeviceInfoReportWithComponents(
|
||||
// SAMPLE_PACCOR_OUTPUT_TXT);
|
||||
|
||||
PlatformCredential base = mock(PlatformCredential.class);
|
||||
PlatformCredential delta1 = mock(PlatformCredential.class);
|
||||
|
||||
ComponentIdentifierV2 compId1 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00010002"),
|
||||
new DERUTF8String("Intel"),
|
||||
new DERUTF8String("Core i7"), new DERUTF8String("Not Specified"),
|
||||
new DERUTF8String("Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz"), null,
|
||||
ASN1Boolean.TRUE, new ArrayList<>(0), null, null,
|
||||
null);
|
||||
ComponentIdentifierV2 compId2 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
new DERUTF8String("Intel Corporation"),
|
||||
new DERUTF8String("Ethernet Connection I217-V-faulty"),
|
||||
new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
null);
|
||||
ComponentIdentifierV2 compId3 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00090002"),
|
||||
new DERUTF8String("Intel Corporation"),
|
||||
new DERUTF8String("82580 Gigabit Network Connection-faulty"),
|
||||
new DERUTF8String("90:e2:ba:31:83:10"), new DERUTF8String(""), null,
|
||||
ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
null);
|
||||
ComponentIdentifierV2 deltaCompId2 = new ComponentIdentifierV2(
|
||||
new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
new DERUTF8String("Intel Corporation"),
|
||||
new DERUTF8String("Ethernet Connection I217-V"),
|
||||
new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
AttributeStatus.ADDED);
|
||||
|
||||
ComponentIdentifierV2 ciV21Faulty = new ComponentIdentifierV2();
|
||||
ComponentIdentifierV2 ciV22Faulty = new ComponentIdentifierV2();
|
||||
ciV21Faulty.setComponentManufacturer(compId2.getComponentManufacturer());
|
||||
ciV21Faulty.setComponentModel(compId2.getComponentModel());
|
||||
ciV21Faulty.setComponentSerial(compId2.getComponentSerial());
|
||||
ciV21Faulty.setComponentRevision(compId2.getComponentRevision());
|
||||
ciV21Faulty.setComponentManufacturerId(compId2.getComponentManufacturerId());
|
||||
ciV21Faulty.setFieldReplaceable(compId2.getFieldReplaceable());
|
||||
ciV21Faulty.setComponentAddress(compId2.getComponentAddress());
|
||||
ciV21Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
ciV22Faulty.setComponentManufacturer(compId3.getComponentManufacturer());
|
||||
ciV22Faulty.setComponentModel(compId3.getComponentModel());
|
||||
ciV22Faulty.setComponentSerial(compId3.getComponentSerial());
|
||||
ciV22Faulty.setComponentRevision(compId3.getComponentRevision());
|
||||
ciV22Faulty.setComponentManufacturerId(compId3.getComponentManufacturerId());
|
||||
ciV22Faulty.setFieldReplaceable(compId3.getFieldReplaceable());
|
||||
ciV22Faulty.setComponentAddress(compId3.getComponentAddress());
|
||||
ciV22Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
|
||||
List<ComponentIdentifier> compList = new ArrayList<>(3);
|
||||
compList.add(compId1);
|
||||
compList.add(compId2);
|
||||
compList.add(compId3);
|
||||
|
||||
List<ComponentIdentifier> delta1List = new ArrayList<>(2);
|
||||
delta1List.add(ciV21Faulty);
|
||||
delta1List.add(deltaCompId2);
|
||||
|
||||
when(base.isPlatformBase()).thenReturn(true);
|
||||
when(delta1.isPlatformBase()).thenReturn(false);
|
||||
when(base.getManufacturer()).thenReturn("innotek GmbH");
|
||||
when(base.getModel()).thenReturn("VirtualBox");
|
||||
when(base.getVersion()).thenReturn("1.2");
|
||||
when(base.getPlatformSerial()).thenReturn("0");
|
||||
when(delta1.getPlatformSerial()).thenReturn("0");
|
||||
when(base.getPlatformChainType()).thenReturn("base");
|
||||
when(delta1.getPlatformChainType()).thenReturn("delta");
|
||||
when(base.getSerialNumber()).thenReturn(BigInteger.ZERO);
|
||||
when(delta1.getSerialNumber()).thenReturn(BigInteger.ONE);
|
||||
when(delta1.getHolderSerialNumber()).thenReturn(BigInteger.ZERO);
|
||||
when(base.getComponentIdentifiers()).thenReturn(compList);
|
||||
when(delta1.getComponentIdentifiers()).thenReturn(delta1List);
|
||||
|
||||
Map<PlatformCredential, SupplyChainValidation> chainCredentials = new HashMap<>(0);
|
||||
List<ArchivableEntity> certsUsed = new ArrayList<>();
|
||||
certsUsed.add(base);
|
||||
chainCredentials.put(base, new SupplyChainValidation(
|
||||
SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
certsUsed.clear();
|
||||
certsUsed.add(delta1);
|
||||
chainCredentials.put(delta1, new SupplyChainValidation(
|
||||
SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
// PlatformCredential base = mock(PlatformCredential.class);
|
||||
// PlatformCredential delta1 = mock(PlatformCredential.class);
|
||||
//
|
||||
// ComponentIdentifierV2 compId1 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00010002"),
|
||||
// new DERUTF8String("Intel"),
|
||||
// new DERUTF8String("Core i7"), new DERUTF8String("Not Specified"),
|
||||
// new DERUTF8String("Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz"), null,
|
||||
// ASN1Boolean.TRUE, new ArrayList<>(0), null, null,
|
||||
// null);
|
||||
// ComponentIdentifierV2 compId2 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
// new DERUTF8String("Intel Corporation"),
|
||||
// new DERUTF8String("Ethernet Connection I217-V-faulty"),
|
||||
// new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
// ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
// null);
|
||||
// ComponentIdentifierV2 compId3 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00090002"),
|
||||
// new DERUTF8String("Intel Corporation"),
|
||||
// new DERUTF8String("82580 Gigabit Network Connection-faulty"),
|
||||
// new DERUTF8String("90:e2:ba:31:83:10"), new DERUTF8String(""), null,
|
||||
// ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
// null);
|
||||
// ComponentIdentifierV2 deltaCompId2 = new ComponentIdentifierV2(
|
||||
// new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
// .getResource(JSON_FILE)).toURI()), "0x00050004"),
|
||||
// new DERUTF8String("Intel Corporation"),
|
||||
// new DERUTF8String("Ethernet Connection I217-V"),
|
||||
// new DERUTF8String("23:94:17:ba:86:5e"), new DERUTF8String("00"), null,
|
||||
// ASN1Boolean.FALSE, new ArrayList<>(0), null, null,
|
||||
// AttributeStatus.ADDED);
|
||||
//
|
||||
// ComponentIdentifierV2 ciV21Faulty = new ComponentIdentifierV2();
|
||||
// ComponentIdentifierV2 ciV22Faulty = new ComponentIdentifierV2();
|
||||
// ciV21Faulty.setComponentManufacturer(compId2.getComponentManufacturer());
|
||||
// ciV21Faulty.setComponentModel(compId2.getComponentModel());
|
||||
// ciV21Faulty.setComponentSerial(compId2.getComponentSerial());
|
||||
// ciV21Faulty.setComponentRevision(compId2.getComponentRevision());
|
||||
// ciV21Faulty.setComponentManufacturerId(compId2.getComponentManufacturerId());
|
||||
// ciV21Faulty.setFieldReplaceable(compId2.getFieldReplaceable());
|
||||
// ciV21Faulty.setComponentAddress(compId2.getComponentAddress());
|
||||
// ciV21Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
// ciV22Faulty.setComponentManufacturer(compId3.getComponentManufacturer());
|
||||
// ciV22Faulty.setComponentModel(compId3.getComponentModel());
|
||||
// ciV22Faulty.setComponentSerial(compId3.getComponentSerial());
|
||||
// ciV22Faulty.setComponentRevision(compId3.getComponentRevision());
|
||||
// ciV22Faulty.setComponentManufacturerId(compId3.getComponentManufacturerId());
|
||||
// ciV22Faulty.setFieldReplaceable(compId3.getFieldReplaceable());
|
||||
// ciV22Faulty.setComponentAddress(compId3.getComponentAddress());
|
||||
// ciV22Faulty.setAttributeStatus(AttributeStatus.REMOVED);
|
||||
//
|
||||
// List<ComponentIdentifier> compList = new ArrayList<>(3);
|
||||
// compList.add(compId1);
|
||||
// compList.add(compId2);
|
||||
// compList.add(compId3);
|
||||
//
|
||||
// List<ComponentIdentifier> delta1List = new ArrayList<>(2);
|
||||
// delta1List.add(ciV21Faulty);
|
||||
// delta1List.add(deltaCompId2);
|
||||
//
|
||||
// when(base.isPlatformBase()).thenReturn(true);
|
||||
// when(delta1.isPlatformBase()).thenReturn(false);
|
||||
// when(base.getManufacturer()).thenReturn("innotek GmbH");
|
||||
// when(base.getModel()).thenReturn("VirtualBox");
|
||||
// when(base.getVersion()).thenReturn("1.2");
|
||||
// when(base.getPlatformSerial()).thenReturn("0");
|
||||
// when(delta1.getPlatformSerial()).thenReturn("0");
|
||||
// when(base.getPlatformChainType()).thenReturn("base");
|
||||
// when(delta1.getPlatformChainType()).thenReturn("delta");
|
||||
// when(base.getSerialNumber()).thenReturn(BigInteger.ZERO);
|
||||
// when(delta1.getSerialNumber()).thenReturn(BigInteger.ONE);
|
||||
// when(delta1.getHolderSerialNumber()).thenReturn(BigInteger.ZERO);
|
||||
// when(base.getComponentIdentifiers()).thenReturn(compList);
|
||||
// when(delta1.getComponentIdentifiers()).thenReturn(delta1List);
|
||||
//
|
||||
// Map<PlatformCredential, SupplyChainValidation> chainCredentials = new HashMap<>(0);
|
||||
// List<ArchivableEntity> certsUsed = new ArrayList<>();
|
||||
// certsUsed.add(base);
|
||||
// chainCredentials.put(base, new SupplyChainValidation(
|
||||
// SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
// AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
// certsUsed.clear();
|
||||
// certsUsed.add(delta1);
|
||||
// chainCredentials.put(delta1, new SupplyChainValidation(
|
||||
// SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
// AppraisalStatus.Status.PASS, certsUsed, ""));
|
||||
|
||||
// AppraisalStatus result = CredentialValidator
|
||||
// .validateDeltaPlatformCredentialAttributes(delta1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user