Last touches

This commit is contained in:
Cyrus 2024-01-02 15:59:29 -05:00
parent 98e9fae754
commit 021e975074
5 changed files with 27 additions and 13 deletions

View File

@ -8,5 +8,12 @@
<!-- https://github.com/spotbugs/spotbugs/pull/2748 -->
<Bug pattern="CT_CONSTRUCTOR_THROW" />
</Match>
<!-- roughly 55 instances of this appear -->
<Match>
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
</FindBugsFilter>

View File

@ -94,6 +94,14 @@ public class Device extends AbstractEntity {
return (Timestamp) lastReportTimestamp.clone();
}
/**
* Setter for the report time stamp.
* @param lastReportTimestamp
*/
public void setLastReportTimestamp(final Timestamp lastReportTimestamp) {
this.lastReportTimestamp = (Timestamp) lastReportTimestamp.clone();
}
public String toString() {
return String.format("Device Name: %s%nStatus: %s%nSummary: %s",
name, healthStatus.getStatus(),

View File

@ -1,8 +1,7 @@
package hirs.attestationca.persist.entity.userdefined.certificate.attributes;
import lombok.AllArgsConstructor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -11,18 +10,18 @@ import java.util.List;
* the Platform Certificate Attribute.
*/
public abstract class PlatformConfiguration {
private List<ComponentIdentifier> componentIdentifier;
private List<ComponentIdentifier> componentIdentifier = new ArrayList<>();
private URIReference componentIdentifierUri;
private List<PlatformProperty> platformProperties;
private List<PlatformProperty> platformProperties = new ArrayList<>();
private URIReference platformPropertiesUri;
/**
* Default constructor.
*/
public PlatformConfiguration() {
this.componentIdentifier = new ArrayList<>();
this.componentIdentifier = Collections.EMPTY_LIST;
this.componentIdentifierUri = null;
this.platformProperties = new ArrayList<>();
this.platformProperties = Collections.EMPTY_LIST;
this.platformPropertiesUri = null;
}
/**
@ -103,7 +102,7 @@ public abstract class PlatformConfiguration {
* @param componentIdentifier the componentIdentifier to set
*/
public void setComponentIdentifier(final List<ComponentIdentifier> componentIdentifier) {
this.componentIdentifier = Collections.unmodifiableList(componentIdentifier);
this.componentIdentifier.addAll(componentIdentifier);
}
/**
@ -130,6 +129,6 @@ public abstract class PlatformConfiguration {
* @param platformProperties the platformProperties to set
*/
public void setPlatformProperties(final List<PlatformProperty> platformProperties) {
this.platformProperties = platformProperties.stream().toList();
this.platformProperties.addAll(platformProperties);
}
}

View File

@ -96,7 +96,7 @@ public class ComponentIdentifierV2 extends ComponentIdentifier {
this.componentClass = componentClass;
// additional optional component identifiers
this.certificateIdentifier = certificateIdentifier;
this.componentPlatformUri = componentPlatformUri;
this.componentPlatformUri = new URIReference(componentPlatformUri.getSequence());
this.attributeStatus = attributeStatus;
}

View File

@ -743,11 +743,11 @@ public class PlatformCredentialTest {
Assertions.assertEquals(platformConfig.getPlatformPropertiesUri()
.getUniformResourceIdentifier().toString(),
"https://www.intel.com/platformproperties.xml");
// Assertions.assertNotNull(platformConfig.getComponentIdentifierUri()); // check it
// Assertions.assertNotNull(platformConfig.getComponentIdentifierUri());
Assertions.assertEquals(platformConfig.getComponentIdentifierUri()
.getUniformResourceIdentifier().toString(),
"https://www.intel.com/platformidentifiers.xml");
// Assertions.assertEquals(platformConfig.getComponentIdentifierUri()
// .getUniformResourceIdentifier().toString(),
// "https://www.intel.com/platformidentifiers.xml");
}