AMBARI-7389 - Alerts: Add UUID Column for AlertNotice (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5fc58284 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5fc58284 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5fc58284 Branch: refs/heads/branch-alerts-dev Commit: 5fc58284f1f286c5b5eaa8d5d40ac240ec0f8aa3 Parents: bf0f4a9 Author: Jonathan Hurley <jhur...@hortonworks.com> Authored: Thu Sep 18 10:21:17 2014 -0400 Committer: Jonathan Hurley <jhur...@hortonworks.com> Committed: Thu Sep 18 10:42:39 2014 -0400 ---------------------------------------------------------------------- .../server/orm/entities/AlertNoticeEntity.java | 51 +++++++-- .../server/upgrade/UpgradeCatalog170.java | 96 +++++++++++++--- .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 1 + .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 1 + .../resources/Ambari-DDL-Postgres-CREATE.sql | 1 + .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 1 + .../server/orm/dao/AlertDefinitionDAOTest.java | 9 +- .../server/upgrade/UpgradeCatalog170Test.java | 110 +++++++++++++++---- 8 files changed, 215 insertions(+), 55 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity.java index af541cd..c9470ce 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity.java @@ -17,6 +17,7 @@ */ package org.apache.ambari.server.orm.entities; +import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -38,7 +39,7 @@ import org.apache.ambari.server.state.NotificationState; * notification to an {@link AlertTargetEntity}. There are three * {@link NotificationState}s that a single notice can exist in. These instances * are persisted indefinitely for historical reference. - * + * */ @Entity @Table(name = "alert_notice") @@ -57,6 +58,10 @@ public class AlertNoticeEntity { @Column(name = "notify_state", nullable = false, length = 255) private NotificationState notifyState; + @Basic + @Column(nullable = false, length = 64) + private String uuid; + /** * Bi-directional many-to-one association to {@link AlertHistoryEntity}. */ @@ -79,7 +84,7 @@ public class AlertNoticeEntity { /** * Gets the unique ID for this alert notice. - * + * * @return the ID (never {@code null}). */ public Long getNotificationId() { @@ -88,7 +93,7 @@ public class AlertNoticeEntity { /** * Sets the unique ID for this alert notice. - * + * * @param notificationId * the ID (not {@code null}). */ @@ -100,7 +105,7 @@ public class AlertNoticeEntity { * Gets the notification state for this alert notice. Alert notices are * pending until they are processed, after which they will either be * successful or failed. - * + * * @return the notification state (never {@code null}). */ public NotificationState getNotifyState() { @@ -109,7 +114,7 @@ public class AlertNoticeEntity { /** * Sets the notification state for this alert notice. - * + * * @param notifyState * the notification state (not {@code null}). */ @@ -118,8 +123,27 @@ public class AlertNoticeEntity { } /** + * Gets the unique ID for this alert notice. + * + * @return the unique ID (never {@code null}). + */ + public String getUuid() { + return uuid; + } + + /** + * Sets the unique ID for this alert notice. + * + * @param uuid + * the unique ID (not {@code null}). + */ + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** * Gets the associated alert history entry for this alert notice. - * + * * @return the historical event that traiggered this notice's creation (never * {@code null}). */ @@ -129,7 +153,7 @@ public class AlertNoticeEntity { /** * Sets the associated alert history entry for this alert notice. - * + * * @param alertHistory * the historical event that traiggered this notice's creation (not * {@code null}). @@ -140,7 +164,7 @@ public class AlertNoticeEntity { /** * Gets the intended audience for the notification. - * + * * @return the recipient of this notification (never {@code null}). */ public AlertTargetEntity getAlertTarget() { @@ -149,7 +173,7 @@ public class AlertNoticeEntity { /** * Sets the intended audience for the notification. - * + * * @param alertTarget * the recipient of this notification (not {@code null}). */ @@ -162,17 +186,20 @@ public class AlertNoticeEntity { */ @Override public boolean equals(Object object) { - if (this == object) + if (this == object) { return true; + } - if (object == null || getClass() != object.getClass()) + if (object == null || getClass() != object.getClass()) { return false; + } AlertNoticeEntity that = (AlertNoticeEntity) object; if (notificationId != null ? !notificationId.equals(that.notificationId) - : that.notificationId != null) + : that.notificationId != null) { return false; + } return true; } http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java index 1c9608c..7eb1116 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java @@ -18,30 +18,87 @@ package org.apache.ambari.server.upgrade; -import com.google.common.reflect.TypeToken; -import com.google.inject.Inject; -import com.google.inject.Injector; +import java.lang.reflect.Type; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Expression; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.configuration.Configuration; import org.apache.ambari.server.controller.AmbariManagementController; import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo; -import org.apache.ambari.server.orm.dao.*; -import org.apache.ambari.server.orm.entities.*; -import org.apache.ambari.server.state.*; +import org.apache.ambari.server.orm.dao.ClusterDAO; +import org.apache.ambari.server.orm.dao.ClusterServiceDAO; +import org.apache.ambari.server.orm.dao.ConfigGroupConfigMappingDAO; +import org.apache.ambari.server.orm.dao.DaoUtils; +import org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO; +import org.apache.ambari.server.orm.dao.HostComponentStateDAO; +import org.apache.ambari.server.orm.dao.HostRoleCommandDAO; +import org.apache.ambari.server.orm.dao.KeyValueDAO; +import org.apache.ambari.server.orm.dao.PermissionDAO; +import org.apache.ambari.server.orm.dao.PrincipalDAO; +import org.apache.ambari.server.orm.dao.PrincipalTypeDAO; +import org.apache.ambari.server.orm.dao.PrivilegeDAO; +import org.apache.ambari.server.orm.dao.ResourceDAO; +import org.apache.ambari.server.orm.dao.ResourceTypeDAO; +import org.apache.ambari.server.orm.dao.ServiceComponentDesiredStateDAO; +import org.apache.ambari.server.orm.dao.ServiceDesiredStateDAO; +import org.apache.ambari.server.orm.dao.UserDAO; +import org.apache.ambari.server.orm.dao.ViewDAO; +import org.apache.ambari.server.orm.dao.ViewInstanceDAO; +import org.apache.ambari.server.orm.entities.ClusterConfigEntity; +import org.apache.ambari.server.orm.entities.ClusterEntity; +import org.apache.ambari.server.orm.entities.ClusterServiceEntity; +import org.apache.ambari.server.orm.entities.ClusterServiceEntityPK; +import org.apache.ambari.server.orm.entities.ConfigGroupConfigMappingEntity; +import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity; +import org.apache.ambari.server.orm.entities.HostComponentStateEntity; +import org.apache.ambari.server.orm.entities.HostRoleCommandEntity; +import org.apache.ambari.server.orm.entities.HostRoleCommandEntity_; +import org.apache.ambari.server.orm.entities.KeyValueEntity; +import org.apache.ambari.server.orm.entities.PermissionEntity; +import org.apache.ambari.server.orm.entities.PrincipalEntity; +import org.apache.ambari.server.orm.entities.PrincipalTypeEntity; +import org.apache.ambari.server.orm.entities.PrivilegeEntity; +import org.apache.ambari.server.orm.entities.ResourceEntity; +import org.apache.ambari.server.orm.entities.ResourceTypeEntity; +import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity; +import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntityPK; +import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity; +import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntityPK; +import org.apache.ambari.server.orm.entities.UserEntity; +import org.apache.ambari.server.orm.entities.ViewEntity; +import org.apache.ambari.server.orm.entities.ViewInstanceEntity; +import org.apache.ambari.server.state.Cluster; +import org.apache.ambari.server.state.Clusters; +import org.apache.ambari.server.state.Config; +import org.apache.ambari.server.state.ConfigHelper; import org.apache.ambari.server.utils.StageUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.persistence.EntityManager; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.*; -import java.lang.reflect.Type; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; -import java.util.Map.Entry; +import com.google.common.reflect.TypeToken; +import com.google.inject.Inject; +import com.google.inject.Injector; /** * Upgrade catalog for version 1.7.0. @@ -610,8 +667,9 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog { pkHCATInHcatalog.setServiceName(serviceNameToBeDeleted); ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntityToDelete = serviceComponentDesiredStateDAO.findByPK(pkHCATInHcatalog); - if (serviceComponentDesiredStateEntityToDelete == null) + if (serviceComponentDesiredStateEntityToDelete == null) { continue; + } ServiceDesiredStateEntityPK serviceDesiredStateEntityPK = new ServiceDesiredStateEntityPK(); serviceDesiredStateEntityPK.setClusterId(clusterEntity.getClusterId()); @@ -902,6 +960,7 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog { columns.add(new DBColumnInfo("target_id", Long.class, null, null, false)); columns.add(new DBColumnInfo("history_id", Long.class, null, null, false)); columns.add(new DBColumnInfo("notify_state", String.class, 255, null, false)); + columns.add(new DBColumnInfo("uuid", String.class, 64, null, false)); dbAccessor.createTable(ALERT_TABLE_NOTICE, columns, "notification_id"); dbAccessor.addFKConstraint(ALERT_TABLE_NOTICE, "fk_alert_notice_target_id", @@ -910,6 +969,9 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog { dbAccessor.addFKConstraint(ALERT_TABLE_NOTICE, "fk_alert_notice_hist_id", "history_id", ALERT_TABLE_HISTORY, "alert_id", false); + dbAccessor.executeQuery("ALTER TABLE " + ALERT_TABLE_NOTICE + + " ADD CONSTRAINT uni_alert_notice_uuid UNIQUE (uuid)", false); + // Indexes dbAccessor.createIndex("idx_alert_history_def_id", ALERT_TABLE_HISTORY, "alert_definition_id"); http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql index a259870..70796c1 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql @@ -236,6 +236,7 @@ CREATE TABLE alert_notice ( target_id BIGINT NOT NULL, history_id BIGINT NOT NULL, notify_state VARCHAR(255) NOT NULL, + uuid VARCHAR(64) NOT NULL UNIQUE, PRIMARY KEY (notification_id), FOREIGN KEY (target_id) REFERENCES alert_target(target_id), FOREIGN KEY (history_id) REFERENCES alert_history(alert_id) http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql index a3b70e5..f9c87b0 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql @@ -227,6 +227,7 @@ CREATE TABLE alert_notice ( target_id NUMBER(19) NOT NULL, history_id NUMBER(19) NOT NULL, notify_state VARCHAR2(255) NOT NULL, + uuid VARCHAR2(64) NOT NULL UNIQUE, PRIMARY KEY (notification_id), FOREIGN KEY (target_id) REFERENCES alert_target(target_id), FOREIGN KEY (history_id) REFERENCES alert_history(alert_id) http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql index 8e14c83..1aa7307 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql @@ -259,6 +259,7 @@ CREATE TABLE alert_notice ( target_id BIGINT NOT NULL, history_id BIGINT NOT NULL, notify_state VARCHAR(255) NOT NULL, + uuid VARCHAR(64) NOT NULL UNIQUE, PRIMARY KEY (notification_id), FOREIGN KEY (target_id) REFERENCES alert_target(target_id), FOREIGN KEY (history_id) REFERENCES alert_history(alert_id) http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql index c8be992..c504bcc 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql @@ -323,6 +323,7 @@ CREATE TABLE ambari.alert_notice ( target_id BIGINT NOT NULL, history_id BIGINT NOT NULL, notify_state VARCHAR(255) NOT NULL, + uuid VARCHAR(64) NOT NULL UNIQUE, PRIMARY KEY (notification_id), FOREIGN KEY (target_id) REFERENCES ambari.alert_target(target_id), FOREIGN KEY (history_id) REFERENCES ambari.alert_history(alert_id) http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java index f2ddcd7..563e076 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java @@ -65,7 +65,7 @@ public class AlertDefinitionDAOTest { OrmTestHelper helper; /** - * + * */ @Before public void setup() { @@ -100,7 +100,7 @@ public class AlertDefinitionDAOTest { } /** - * + * */ @Test public void testFindByName() { @@ -114,7 +114,7 @@ public class AlertDefinitionDAOTest { } /** - * + * */ @Test public void testFindAll() { @@ -124,7 +124,7 @@ public class AlertDefinitionDAOTest { } /** - * + * */ @Test public void findById() { @@ -190,6 +190,7 @@ public class AlertDefinitionDAOTest { notice.setAlertHistory(history); notice.setAlertTarget(helper.createAlertTarget()); notice.setNotifyState(NotificationState.PENDING); + notice.setUuid(UUID.randomUUID().toString()); dispatchDao.create(notice); group = dispatchDao.findGroupById(group.getGroupId()); http://git-wip-us.apache.org/repos/asf/ambari/blob/5fc58284/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java index dcf308c..6732455 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java @@ -18,39 +18,105 @@ package org.apache.ambari.server.upgrade; -import com.google.inject.*; -import com.google.inject.persist.PersistService; -import com.google.inject.persist.Transactional; +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNull; +import static junit.framework.Assert.assertTrue; +import static org.easymock.EasyMock.anyObject; +import static org.easymock.EasyMock.capture; +import static org.easymock.EasyMock.createMockBuilder; +import static org.easymock.EasyMock.createNiceMock; +import static org.easymock.EasyMock.createStrictMock; +import static org.easymock.EasyMock.eq; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.expectLastCall; +import static org.easymock.EasyMock.isA; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.reset; +import static org.easymock.EasyMock.verify; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Order; +import javax.persistence.criteria.Path; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import javax.persistence.metamodel.SingularAttribute; + import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.configuration.Configuration; import org.apache.ambari.server.controller.AmbariManagementController; import org.apache.ambari.server.orm.DBAccessor; import org.apache.ambari.server.orm.GuiceJpaInitializer; import org.apache.ambari.server.orm.InMemoryDefaultTestModule; -import org.apache.ambari.server.orm.dao.*; -import org.apache.ambari.server.orm.entities.*; -import org.apache.ambari.server.state.*; +import org.apache.ambari.server.orm.dao.ClusterDAO; +import org.apache.ambari.server.orm.dao.ClusterServiceDAO; +import org.apache.ambari.server.orm.dao.ConfigGroupConfigMappingDAO; +import org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO; +import org.apache.ambari.server.orm.dao.HostDAO; +import org.apache.ambari.server.orm.dao.KeyValueDAO; +import org.apache.ambari.server.orm.dao.PermissionDAO; +import org.apache.ambari.server.orm.dao.PrincipalDAO; +import org.apache.ambari.server.orm.dao.PrincipalTypeDAO; +import org.apache.ambari.server.orm.dao.PrivilegeDAO; +import org.apache.ambari.server.orm.dao.ResourceDAO; +import org.apache.ambari.server.orm.dao.ResourceTypeDAO; +import org.apache.ambari.server.orm.dao.ServiceComponentDesiredStateDAO; +import org.apache.ambari.server.orm.dao.UserDAO; +import org.apache.ambari.server.orm.dao.ViewDAO; +import org.apache.ambari.server.orm.dao.ViewInstanceDAO; +import org.apache.ambari.server.orm.entities.ClusterConfigEntity; +import org.apache.ambari.server.orm.entities.ClusterEntity; +import org.apache.ambari.server.orm.entities.ClusterServiceEntity; +import org.apache.ambari.server.orm.entities.ConfigGroupConfigMappingEntity; +import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity; +import org.apache.ambari.server.orm.entities.HostComponentStateEntity; +import org.apache.ambari.server.orm.entities.HostEntity; +import org.apache.ambari.server.orm.entities.HostRoleCommandEntity; +import org.apache.ambari.server.orm.entities.KeyValueEntity; +import org.apache.ambari.server.orm.entities.PrivilegeEntity; +import org.apache.ambari.server.orm.entities.ResourceEntity; +import org.apache.ambari.server.orm.entities.ResourceTypeEntity; +import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity; +import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity; +import org.apache.ambari.server.orm.entities.UserEntity; +import org.apache.ambari.server.orm.entities.ViewEntity; +import org.apache.ambari.server.orm.entities.ViewInstanceEntity; +import org.apache.ambari.server.state.Cluster; +import org.apache.ambari.server.state.Clusters; +import org.apache.ambari.server.state.Config; +import org.apache.ambari.server.state.ConfigHelper; +import org.apache.ambari.server.state.HostComponentAdminState; +import org.apache.ambari.server.state.StackId; import org.easymock.Capture; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import javax.persistence.EntityManager; -import javax.persistence.EntityTransaction; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.*; -import javax.persistence.metamodel.SingularAttribute; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; - -import static junit.framework.Assert.*; -import static org.easymock.EasyMock.*; +import com.google.inject.Binder; +import com.google.inject.Guice; +import com.google.inject.Injector; +import com.google.inject.Module; +import com.google.inject.Provider; +import com.google.inject.persist.PersistService; +import com.google.inject.persist.Transactional; /** * UpgradeCatalog170 unit tests. @@ -311,7 +377,7 @@ public class UpgradeCatalog170Test { assertEquals(5, alertTargetCapture.getValue().size()); assertEquals(2, alertGroupTargetCapture.getValue().size()); assertEquals(2, alertGroupingCapture.getValue().size()); - assertEquals(4, alertNoticeCapture.getValue().size()); + assertEquals(5, alertNoticeCapture.getValue().size()); assertEquals(2, serviceConfigCapture.getValue().size()); assertEquals(2, serviceConfigMappingCapture.getValue().size()); }