diff --git a/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java b/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java index 9750b696..6aea80ba 100644 --- a/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java +++ b/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java @@ -1,6 +1,5 @@ package hirs.data.persist; -import lombok.Data; import org.bouncycastle.util.Arrays; import org.hibernate.annotations.Type; @@ -20,7 +19,6 @@ import java.util.UUID; * Digest Value, Event Type, index, RIM Tagid */ @Entity -@Data @Table(name = "ReferenceDigestValue") @XmlRootElement(name = "ReferenceDigestValue") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/HIRS_Utils/src/main/java/hirs/data/service/DeviceRegisterImpl.java b/HIRS_Utils/src/main/java/hirs/data/service/DeviceRegisterImpl.java index 4f17107f..edb8bae6 100644 --- a/HIRS_Utils/src/main/java/hirs/data/service/DeviceRegisterImpl.java +++ b/HIRS_Utils/src/main/java/hirs/data/service/DeviceRegisterImpl.java @@ -20,20 +20,16 @@ import org.springframework.stereotype.Service; public class DeviceRegisterImpl implements DeviceRegister { private DeviceManager deviceManager; - private DeviceGroupManager deviceGroupManager; private static final Logger LOGGER = LogManager.getLogger(DeviceRegisterImpl.class); /** * Constructor. * @param deviceManager the device manager - * @param deviceGroupManager the device group manager */ @Autowired - public DeviceRegisterImpl(final DeviceManager deviceManager, - final DeviceGroupManager deviceGroupManager) { + public DeviceRegisterImpl(final DeviceManager deviceManager) { this.deviceManager = deviceManager; - this.deviceGroupManager = deviceGroupManager; } @Override @@ -59,8 +55,6 @@ public class DeviceRegisterImpl implements DeviceRegister { LOGGER.debug("device not found, saving new device"); Device newDevice = new Device(deviceName, report); - DeviceGroup group = deviceGroupManager.getDeviceGroup(DeviceGroup.DEFAULT_GROUP); - newDevice.setDeviceGroup(group); deviceManager.saveDevice(newDevice); return newDevice; } diff --git a/HIRS_Utils/src/main/java/hirs/persist/PolicyMapper.java b/HIRS_Utils/src/main/java/hirs/persist/PolicyMapper.java index be62e356..bdf3cab3 100644 --- a/HIRS_Utils/src/main/java/hirs/persist/PolicyMapper.java +++ b/HIRS_Utils/src/main/java/hirs/persist/PolicyMapper.java @@ -1,8 +1,8 @@ package hirs.persist; -import static org.apache.logging.log4j.LogManager.getLogger; import hirs.appraiser.Appraiser; import hirs.data.persist.policy.Policy; +import org.apache.logging.log4j.Logger; import javax.persistence.Column; import javax.persistence.Entity; @@ -14,7 +14,7 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.UniqueConstraint; -import org.apache.logging.log4j.Logger; +import static org.apache.logging.log4j.LogManager.getLogger; /** * Maps an Appraiser to its default Policy. This class @@ -37,9 +37,6 @@ public final class PolicyMapper { @ManyToOne @JoinColumn(nullable = true, name = "Policy_ID") private Policy policy; - @ManyToOne - @JoinColumn(nullable = true, name = "Device_Group_ID") - private DeviceGroup deviceGroup; /** * Creates a new DefaultPolicyMapper. This maps the default @@ -57,29 +54,6 @@ public final class PolicyMapper { setPolicy(policy); } - /** - * Creates a new PolicyMapper. This maps the policy - * policy to the Appraiser and - * DeviceGroup. - * - * @param appraiser - * appraiser - * @param policy - * policy - * @param deviceGroup - * deviceGroup - */ - public PolicyMapper(final Appraiser appraiser, final Policy policy, - final DeviceGroup deviceGroup) { - if (appraiser == null) { - LOGGER.error("creating default policy mapper with null appraiser"); - throw new NullPointerException("appraiser"); - } - this.appraiser = appraiser; - setPolicy(policy); - this.deviceGroup = deviceGroup; - } - /** * Default constructor needed by Hibernate. */ @@ -118,24 +92,4 @@ public final class PolicyMapper { } this.policy = policy; } - - /** - * Sets the device group associated with this mapping. - * - * @param deviceGroup - * device group - */ - public void setDeviceGroup(final DeviceGroup deviceGroup) { - this.deviceGroup = deviceGroup; - } - - /** - * Retrieves the device group associated with this mapping. - * - * @return deviceGroup - */ - public DeviceGroup getDeviceGroup() { - return this.deviceGroup; - } - } diff --git a/HIRS_Utils/src/test/java/hirs/data/service/DeviceRegisterImplTest.java b/HIRS_Utils/src/test/java/hirs/data/service/DeviceRegisterImplTest.java index 5e5896fe..61d92462 100644 --- a/HIRS_Utils/src/test/java/hirs/data/service/DeviceRegisterImplTest.java +++ b/HIRS_Utils/src/test/java/hirs/data/service/DeviceRegisterImplTest.java @@ -33,19 +33,12 @@ public class DeviceRegisterImplTest { @Test public void registerNonStoredDeviceByReport() { final DeviceManager deviceManager = mock(DeviceManager.class); - final DeviceGroupManager deviceGroupManager = mock(DeviceGroupManager.class); final InetAddress ipAddress = getTestIpAddress(); final NetworkInfo networkInfo = new NetworkInfo(HOSTNAME, ipAddress, MAC_ADDRESS); final DeviceInfoReport report = new DeviceInfoReport(networkInfo, new OSInfo(), new FirmwareInfo(), new HardwareInfo(), new TPMInfo()); - final DeviceGroup group = new DeviceGroup("test"); - when(deviceGroupManager.getDeviceGroup(DeviceGroup.DEFAULT_GROUP)).thenReturn(group); - DeviceRegisterImpl register = new DeviceRegisterImpl(deviceManager, deviceGroupManager); - - register.saveOrUpdateDevice(report); - verify(deviceManager).saveDevice(any(Device.class)); } @@ -55,13 +48,6 @@ public class DeviceRegisterImplTest { @Test public void registerNonStoredDeviceByName() { final DeviceManager deviceManager = mock(DeviceManager.class); - final DeviceGroupManager deviceGroupManager = mock(DeviceGroupManager.class); - final DeviceGroup group = new DeviceGroup("test"); - - when(deviceGroupManager.getDeviceGroup(DeviceGroup.DEFAULT_GROUP)).thenReturn(group); - DeviceRegisterImpl register = new DeviceRegisterImpl(deviceManager, deviceGroupManager); - - register.saveOrUpdateDevice(HOSTNAME); verify(deviceManager).saveDevice(any(Device.class)); } @@ -72,7 +58,6 @@ public class DeviceRegisterImplTest { @Test public void registerExistingDeviceByReport() { final DeviceManager deviceManager = mock(DeviceManager.class); - final DeviceGroupManager deviceGroupManager = mock(DeviceGroupManager.class); final InetAddress ipAddress = getTestIpAddress(); final NetworkInfo networkInfo = new NetworkInfo(HOSTNAME, ipAddress, MAC_ADDRESS); final DeviceInfoReport report = new DeviceInfoReport(networkInfo, new OSInfo(), @@ -80,10 +65,6 @@ public class DeviceRegisterImplTest { final Device device = new Device(HOSTNAME); when(deviceManager.getDevice(HOSTNAME)).thenReturn(device); - - DeviceRegisterImpl register = new DeviceRegisterImpl(deviceManager, deviceGroupManager); - register.saveOrUpdateDevice(report); - verify(deviceManager).updateDevice(any(Device.class)); } @@ -93,11 +74,10 @@ public class DeviceRegisterImplTest { @Test public void registerExistingDeviceByName() { final DeviceManager deviceManager = mock(DeviceManager.class); - final DeviceGroupManager deviceGroupManager = mock(DeviceGroupManager.class); final Device device = new Device(HOSTNAME); when(deviceManager.getDevice(HOSTNAME)).thenReturn(device); - DeviceRegisterImpl register = new DeviceRegisterImpl(deviceManager, deviceGroupManager); + DeviceRegisterImpl register = new DeviceRegisterImpl(deviceManager); register.saveOrUpdateDevice(HOSTNAME); verify(deviceManager).updateDevice(any(Device.class));