investigating springboot not loading; getting lombok set

This commit is contained in:
Cyrus 2022-11-29 09:22:21 -05:00
parent f5a6eccd6f
commit db19ed7b19
12 changed files with 40 additions and 39 deletions

View File

@ -21,6 +21,8 @@ dependencies {
implementation libs.commons.codec
implementation libs.commons.lang
implementation libs.commons.io
implementation libs.minimal.json
implementation libs.pci.ids
implementation libs.guava
implementation libs.javax.jaxb
implementation libs.spring.webmvc
@ -31,6 +33,8 @@ dependencies {
implementation libs.log4j2
implementation libs.log4j2.web
implementation libs.protobuf.java
implementation libs.lombok
annotationProcessor libs.lombok
implementation libs.servlet.api

View File

@ -30,31 +30,31 @@ public final class AcaDbInit {
public static synchronized void insertDefaultEntries(
final AppraiserService appraiserService,
final PolicyService policyService) {
LOG.info("Ensuring default ACA database entries are present.");
LOG.error("Ensuring default ACA database entries are present.");
// If the SupplyChainAppraiser exists, do not attempt to re-save the supply chain appraiser
// or SupplyChainPolicy
SupplyChainAppraiser supplyChainAppraiser = (SupplyChainAppraiser)
appraiserService.getAppraiser(SupplyChainAppraiser.NAME);
if (supplyChainAppraiser != null) {
LOG.info("Supply chain appraiser is present; not inserting any more entries.");
LOG.error("Supply chain appraiser is present; not inserting any more entries.");
LOG.info("ACA database initialization complete.");
return;
}
// Create the SupplyChainAppraiser
LOG.info("Saving supply chain appraiser...");
LOG.error("Saving supply chain appraiser...");
supplyChainAppraiser = (SupplyChainAppraiser)
appraiserService.saveAppraiser(new SupplyChainAppraiser());
// Create the SupplyChainPolicy
LOG.info("Saving default supply chain policy...");
LOG.error("Saving default supply chain policy...");
SupplyChainPolicy supplyChainPolicy = new SupplyChainPolicy(
SupplyChainPolicy.DEFAULT_POLICY);
policyService.savePolicy(supplyChainPolicy);
policyService.setDefaultPolicy(supplyChainAppraiser, supplyChainPolicy);
policyService.setPolicy(supplyChainAppraiser, supplyChainPolicy);
LOG.info("ACA database initialization complete.");
LOG.error("ACA database initialization complete.");
}
}

View File

@ -54,7 +54,7 @@ public final class SystemInit {
*/
@SuppressWarnings("checkstyle:methodlength")
public static void main(final String[] args) {
LOGGER.info("Seeding database with initial entries...");
LOGGER.error("Seeding database with initial entries...");
// construct application context
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.getEnvironment().addActiveProfile(HIRSProfiles.SERVER);
@ -68,7 +68,7 @@ public final class SystemInit {
// scan for appraiser plugins
int registeredBeanCount = scanner.scan("hirs");
System.out.println("Beans scanned " + registeredBeanCount);
LOGGER.info("Beans scanned: " + registeredBeanCount);
LOGGER.error("Beans scanned: " + registeredBeanCount);
// register the database configuration and refresh the context
context.register(PersistenceConfiguration.class);
@ -94,7 +94,7 @@ public final class SystemInit {
LOGGER.info("DeviceInfo appraiser found.");
}
LOGGER.info("Checking for TPM appraiser...");
LOGGER.error("Checking for TPM appraiser...");
TPMAppraiser tpmApp = (TPMAppraiser) appraiserServiceImpl.getAppraiser(TPMAppraiser.NAME);
if (tpmApp == null) {
LOGGER.info("TPM appraiser not found; creating...");

View File

@ -19,6 +19,8 @@ import java.util.Collection;
/**
* Sub class that will just focus on PCR Values and Events.
*/
@Getter
@Setter
@Entity
public class SupportReferenceManifest extends ReferenceManifest {
private static final Logger LOGGER = LogManager.getLogger(SupportReferenceManifest.class);

View File

@ -1,7 +1,7 @@
package hirs.attestationca.entity.certificate;
import hirs.attestationca.entity.CertificateSelector;
import hirs.persist.service.CertificateService;
import hirs.attestationca.service.CertificateService;
import javax.persistence.Entity;
import java.io.IOException;

View File

@ -13,14 +13,14 @@ import java.util.UUID;
public interface ReportSummaryRepository<T extends ReportSummary>
extends JpaRepository<ReportSummary, UUID> {
/**
* Saves the <code>ReportSummary</code> in the database. This creates a new
* database session and saves the report summary.
*
* @param reportSummary ReportSummary to save
* @return reference to saved reportSummary
*/
T save(T reportSummary);
// /**
// * Saves the <code>ReportSummary</code> in the database. This creates a new
// * database session and saves the report summary.
// *
// * @param reportSummary ReportSummary to save
// * @return reference to saved reportSummary
// */
// T save(T reportSummary);
/**
* Update the <code>ReportSummary</code> in the database. This creates a new

View File

@ -1,12 +1,12 @@
package hirs.attestationca.service;
import hirs.FilteredRecordsList;
import hirs.attestationca.entity.ReferenceManifest;
import hirs.attestationca.entity.ReferenceManifestSelector;
import hirs.attestationca.repository.ReferenceManifestRepository;
import hirs.data.persist.ArchivableEntity;
import hirs.attestationca.entity.ReferenceManifest;
import hirs.persist.CriteriaModifier;
import hirs.persist.DBManagerException;
import hirs.persist.service.ReferenceManifestService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -7,6 +7,6 @@
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Instructs Spring to scan the ACA packages for annotations -->
<context:component-scan base-package="hirs.attestationca.entity"/>
<context:component-scan base-package="hirs.attestationca"/>
</beans>

View File

@ -37,6 +37,8 @@ dependencies {
implementation libs.spring.orm
implementation libs.spring.transaction
implementation libs.spring.webmvc
implementation libs.lombok
annotationProcessor libs.lombok
testImplementation libs.hamcrest
// override the servlet API for testing. Required for Spring Integration tests

View File

@ -16,6 +16,7 @@ import hirs.attestationca.entity.ReferenceManifest;
import hirs.attestationca.entity.SupportReferenceManifest;
import hirs.attestationca.entity.SwidResource;
import hirs.attestationca.entity.certificate.Certificate;
import hirs.attestationca.service.ReferenceDigestValueService;
import hirs.persist.CriteriaModifier;
import hirs.persist.DBManagerException;
import hirs.attestationca.service.ReferenceManifestService;
@ -78,7 +79,7 @@ public class ReferenceManifestPageController
@Autowired
private final ReferenceManifestService referenceManifestService;
@Autowired
private final ReferenceEventManager referenceEventManager;
private final ReferenceDigestValueService referenceDigestValueService;
private static final Logger LOGGER
= LogManager.getLogger(ReferenceManifestPageController.class);
@ -128,15 +129,15 @@ public class ReferenceManifestPageController
* Constructor providing the Page's display and routing specification.
*
* @param referenceManifestService the reference manifest service
* @param referenceEventManager this is the reference event manager
* @param referenceDigestValueService this is the reference digest value service
*/
@Autowired
public ReferenceManifestPageController(
final ReferenceManifestService referenceManifestService,
final ReferenceEventManager referenceEventManager) {
final ReferenceDigestValueService referenceDigestValueService) {
super(Page.REFERENCE_MANIFESTS);
this.referenceManifestService = referenceManifestService;
this.referenceEventManager = referenceEventManager;
this.referenceDigestValueService = referenceDigestValueService;
this.biosValidator = new BiosDateValidator(BIOS_RELEASE_DATE_FORMAT);
}
@ -296,12 +297,12 @@ public class ReferenceManifestPageController
// if support rim, update associated events
if (referenceManifest instanceof SupportReferenceManifest) {
List<ReferenceDigestValue> rdvs = referenceEventManager
.getValuesByRimId(referenceManifest);
List<ReferenceDigestValue> rdvs = referenceDigestValueService
.getValuesByBaseRimId(referenceManifest.getId());
for (ReferenceDigestValue rdv : rdvs) {
rdv.archive("Support RIM was deleted");
referenceEventManager.updateEvent(rdv);
referenceDigestValueService.updateDigestValue(rdv, rdv.getId());
}
}
}
@ -652,7 +653,7 @@ public class ReferenceManifestPageController
// get by support rim id NEXT
if (dbSupport.getPlatformManufacturer() != null) {
tpmEvents = referenceEventManager.getValuesByRimId(dbSupport);
tpmEvents = referenceDigestValueService.getValuesByBaseRimId(dbSupport.getId());
baseRim = findBaseRim(dbSupport);
if (tpmEvents.isEmpty()) {
ReferenceDigestValue rdv;
@ -665,7 +666,7 @@ public class ReferenceManifestPageController
tpe.getEventDigestStr(), tpe.getEventTypeStr(),
false, false, updated, tpe.getEventContent());
this.referenceEventManager.saveValue(rdv);
this.referenceDigestValueService.saveDigestValue(rdv);
}
} catch (CertificateException e) {
e.printStackTrace();
@ -678,7 +679,7 @@ public class ReferenceManifestPageController
for (ReferenceDigestValue rdv : tpmEvents) {
if (!rdv.isUpdated()) {
rdv.updateInfo(dbSupport, baseRim.getId());
this.referenceEventManager.updateEvent(rdv);
this.referenceDigestValueService.updateDigestValue(rdv, rdv.getId());
}
}
}

View File

@ -80,13 +80,4 @@ public class TPMReportRequestTest {
TPMReportRequest tpmRepReq = new TPMReportRequest(TEST_NONCE, TEST_MASK);
Assert.assertEquals(tpmRepReq.getPcrMask(), TEST_MASK);
}
/**
* Tests ReportType getter method.
*/
@Test
public final void getReportType() {
TPMReportRequest tpmRepReq = new TPMReportRequest(TEST_NONCE, TEST_MASK);
Assert.assertEquals(tpmRepReq.getReportType(), TPMReport.class);
}
}

View File

@ -50,6 +50,7 @@ dependencyResolutionManagement {
library('log4j2-impl', 'org.apache.logging.log4j:log4j-slf4j-impl:2.17.1')
library('log4j2_web', 'org.apache.logging.log4j:log4j-web:2.17.1')
library('log4j2_bridge', 'org.apache.logging.log4j:log4j-jcl:2.17.1')
library('lombok', 'org.projectlombok:lombok:1.18.24')
library('mariadb', 'org.mariadb.jdbc:mariadb-java-client:3.0.4')
library('minimal_json', 'com.eclipsesource.minimal-json:minimal-json:0.9.5')
library('mockito', 'org.mockito:mockito-all:1.10.19')