diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-02-15 20:03:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-02-15 20:03:50 +0000 |
commit | 016806194bdab12fee925f0733c31d70ad088479 (patch) | |
tree | d70f75456adbac433c12100a1809b1eaa5ce5177 /integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java | |
parent | bb47fc9ed422dcde4a1544955c8ab1da7d074a2e (diff) | |
parent | e871132b09476d7772fb8dbc597fb82248b89f6b (diff) |
Merge "Speed up integrity-audit tests"
Diffstat (limited to 'integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java')
-rw-r--r-- | integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java index fb8823f5..da69f2de 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java @@ -1,8 +1,8 @@ -/*- +/* * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ package org.onap.policy.common.ia.jpa; +import java.io.IOException; +import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Date; @@ -105,9 +107,7 @@ public class IntegrityAuditEntity implements Serializable { @PreUpdate public void preUpdate() { - if (!isUnitTesting()) { - this.lastUpdated = new Date(); - } + this.lastUpdated = new Date(); } public long getId() { @@ -209,4 +209,17 @@ public class IntegrityAuditEntity implements Serializable { public static void setUnitTesting(boolean isUnitTesting) { IntegrityAuditEntity.isUnitTesting = isUnitTesting; } + + private void writeObject(ObjectOutputStream out) throws IOException { + if(isUnitTesting()) { + /* + * Note: other fields may be added here, as long as the + * created-date and last-updated date are not included. + */ + out.writeObject(jdbcUrl); + + } else { + out.defaultWriteObject(); + } + } } |