Repository: ambari Updated Branches: refs/heads/trunk afe427a0f -> 2e64b3b9f
AMBARI-11200. Fix ignored persistence-related unit tests (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2e64b3b9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2e64b3b9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2e64b3b9 Branch: refs/heads/trunk Commit: 2e64b3b9f71d3681b6c37ab5e7b39087c989a306 Parents: afe427a Author: Lisnichenko Dmitro <[email protected]> Authored: Tue May 19 12:30:28 2015 +0300 Committer: Lisnichenko Dmitro <[email protected]> Committed: Tue May 19 12:30:28 2015 +0300 ---------------------------------------------------------------------- ambari-server/pom.xml | 6 +++++ .../server/orm/entities/AlertTargetEntity.java | 8 ++++++ .../HostVersionOutOfSyncListenerTest.java | 3 +++ .../server/orm/dao/AlertDefinitionDAOTest.java | 7 ++--- .../server/orm/dao/AlertDispatchDAOTest.java | 10 +++++--- .../ambari/server/orm/dao/AlertsDAOTest.java | 27 +++----------------- .../upgrades/UpgradeActionTest.java | 6 ++--- .../state/alerts/InitialAlertEventTest.java | 2 -- .../state/cluster/AlertDataManagerTest.java | 7 ++--- .../server/state/cluster/ClusterTest.java | 26 +++---------------- 10 files changed, 42 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml index 4c34e6a..4158d95 100644 --- a/ambari-server/pom.xml +++ b/ambari-server/pom.xml @@ -1460,6 +1460,12 @@ <artifactId>derby</artifactId> </dependency> <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derbytools</artifactId> + <version>10.11.1.1</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java index ce29921..5151a4a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java @@ -320,6 +320,14 @@ public class AlertTargetEntity { alertNotices.add(notice); } + public List<AlertNoticeEntity> getAlertNotices() { + return alertNotices; + } + + public void setAlertNotices(List<AlertNoticeEntity> alertNotices) { + this.alertNotices = alertNotices; + } + /** * Called before {@link EntityManager#remove(Object)} for this entity, removes * the non-owning relationship between targets and groups. http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/HostVersionOutOfSyncListenerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/HostVersionOutOfSyncListenerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/HostVersionOutOfSyncListenerTest.java index 7f5cbfb..078d4c7 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/HostVersionOutOfSyncListenerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/HostVersionOutOfSyncListenerTest.java @@ -32,6 +32,7 @@ import java.util.Map; import java.util.Set; import com.google.inject.Inject; +import com.google.inject.persist.UnitOfWork; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.services.AmbariMetaInfo; import org.apache.ambari.server.events.ServiceComponentInstalledEvent; @@ -101,6 +102,7 @@ public class HostVersionOutOfSyncListenerTest { EventBusSynchronizer.synchronizeAmbariEventPublisher(injector); injector.injectMembers(this); + injector.getInstance(UnitOfWork.class).begin(); StackId stackId = new StackId(this.stackId); clusters.addCluster("c1", stackId); @@ -115,6 +117,7 @@ public class HostVersionOutOfSyncListenerTest { @After public void teardown() { + injector.getInstance(UnitOfWork.class).end(); injector.getInstance(PersistService.class).stop(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/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 547edf2..95209d4 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 @@ -29,6 +29,7 @@ import java.util.List; import java.util.TimeZone; import java.util.UUID; +import com.google.inject.persist.UnitOfWork; import org.apache.ambari.server.controller.RootServiceResponseFactory; import org.apache.ambari.server.orm.GuiceJpaInitializer; import org.apache.ambari.server.orm.InMemoryDefaultTestModule; @@ -48,7 +49,6 @@ import org.apache.ambari.server.state.alert.Scope; import org.apache.ambari.server.state.alert.SourceType; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import com.google.inject.Guice; @@ -77,6 +77,7 @@ public class AlertDefinitionDAOTest { public void setup() throws Exception { injector = Guice.createInjector(new InMemoryDefaultTestModule()); injector.getInstance(GuiceJpaInitializer.class); + injector.getInstance(UnitOfWork.class).begin(); dispatchDao = injector.getInstance(AlertDispatchDAO.class); dao = injector.getInstance(AlertDefinitionDAO.class); @@ -157,6 +158,8 @@ public class AlertDefinitionDAOTest { @After public void teardown() { + injector.getInstance(UnitOfWork.class).end(); + injector.getInstance(PersistService.class).stop(); injector = null; } @@ -297,7 +300,6 @@ public class AlertDefinitionDAOTest { * @throws Exception */ @Test - @Ignore public void testCascadeDelete() throws Exception { AlertDefinitionEntity definition = helper.createAlertDefinition(clusterId); @@ -369,7 +371,6 @@ public class AlertDefinitionDAOTest { * @throws Exception */ @Test - @Ignore public void testCascadeDeleteForCluster() throws Exception { AlertDefinitionEntity definition = helper.createAlertDefinition(clusterId); definition = dao.findById(definition.getDefinitionId()); http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java index 4138774..df7e72d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java @@ -32,7 +32,9 @@ import java.util.List; import java.util.Set; import java.util.UUID; +import com.google.inject.persist.UnitOfWork; import org.apache.ambari.server.AmbariException; +import org.apache.ambari.server.configuration.Configuration; import org.apache.ambari.server.controller.AlertNoticeRequest; import org.apache.ambari.server.controller.internal.AlertNoticeResourceProvider; import org.apache.ambari.server.controller.internal.PageRequestImpl; @@ -98,6 +100,8 @@ public class AlertDispatchDAOTest { public void setup() throws Exception { m_injector = Guice.createInjector(new InMemoryDefaultTestModule()); m_injector.getInstance(GuiceJpaInitializer.class); + m_injector.getInstance(UnitOfWork.class).begin(); + m_dao = m_injector.getInstance(AlertDispatchDAO.class); m_alertsDao = m_injector.getInstance(AlertsDAO.class); m_definitionDao = m_injector.getInstance(AlertDefinitionDAO.class); @@ -134,6 +138,7 @@ public class AlertDispatchDAOTest { */ @After public void teardown() throws Exception { + m_injector.getInstance(UnitOfWork.class).end(); m_injector.getInstance(PersistService.class).stop(); m_injector = null; } @@ -262,7 +267,6 @@ public class AlertDispatchDAOTest { * */ @Test - @Ignore public void testGroupDefinitions() throws Exception { List<AlertDefinitionEntity> definitions = createDefinitions(); @@ -301,7 +305,6 @@ public class AlertDispatchDAOTest { * */ @Test - @Ignore public void testCreateTarget() throws Exception { int targetCount = m_dao.findAllTargets().size(); @@ -480,6 +483,8 @@ public class AlertDispatchDAOTest { notice = m_dao.findNoticeById(notice.getNotificationId()); assertEquals(target.getTargetId(), notice.getAlertTarget().getTargetId()); + //new org.apache.derby.tools.dblook(new String[]{"-d", Configuration.JDBC_IN_MEMORY_URL, "-verbose", "-o", "/tmp/1.ddl"}); + target = m_dao.findTargetById(target.getTargetId()); m_dao.remove(target); notice = m_dao.findNoticeById(notice.getNotificationId()); @@ -490,7 +495,6 @@ public class AlertDispatchDAOTest { * */ @Test - @Ignore public void testDeleteAssociatedTarget() throws Exception { AlertTargetEntity target = m_helper.createAlertTarget(); Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>(); http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java index c774474..6bf808d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.TimeZone; import java.util.UUID; +import com.google.inject.persist.UnitOfWork; import org.apache.ambari.server.controller.AlertCurrentRequest; import org.apache.ambari.server.controller.AlertHistoryRequest; import org.apache.ambari.server.controller.internal.AlertHistoryResourceProvider; @@ -66,7 +67,6 @@ import org.apache.ambari.server.state.alert.SourceType; import org.apache.ambari.server.utils.EventBusSynchronizer; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import com.google.inject.Guice; @@ -101,6 +101,8 @@ public class AlertsDAOTest { public void setup() throws Exception { m_injector = Guice.createInjector(new InMemoryDefaultTestModule()); m_injector.getInstance(GuiceJpaInitializer.class); + m_injector.getInstance(UnitOfWork.class).begin(); + m_helper = m_injector.getInstance(OrmTestHelper.class); m_dao = m_injector.getInstance(AlertsDAO.class); m_definitionDao = m_injector.getInstance(AlertDefinitionDAO.class); @@ -195,6 +197,7 @@ public class AlertsDAOTest { */ @After public void teardown() { + m_injector.getInstance(UnitOfWork.class).end(); m_injector.getInstance(PersistService.class).stop(); m_injector = null; } @@ -204,7 +207,6 @@ public class AlertsDAOTest { * */ @Test - @Ignore public void testFindAll() { List<AlertHistoryEntity> alerts = m_dao.findAll(m_cluster.getClusterId()); assertNotNull(alerts); @@ -215,7 +217,6 @@ public class AlertsDAOTest { * */ @Test - @Ignore public void testFindAllCurrent() { List<AlertCurrentEntity> currentAlerts = m_dao.findCurrent(); assertNotNull(currentAlerts); @@ -226,7 +227,6 @@ public class AlertsDAOTest { * Test looking up current alerts by definition ID. */ @Test - @Ignore public void testFindCurrentByDefinitionId() throws Exception { // create a host AlertDefinitionEntity definition = new AlertDefinitionEntity(); @@ -288,7 +288,6 @@ public class AlertsDAOTest { * */ @Test - @Ignore public void testFindCurrentByService() { List<AlertCurrentEntity> currentAlerts = m_dao.findCurrent(); int currentAlertExpectedCount = currentAlerts.size(); @@ -315,7 +314,6 @@ public class AlertsDAOTest { * Test looking up current by a host name. */ @Test - @Ignore public void testFindCurrentByHost() throws Exception { // create a host AlertDefinitionEntity hostDef = new AlertDefinitionEntity(); @@ -377,7 +375,6 @@ public class AlertsDAOTest { * @throws Exception */ @Test - @Ignore public void testAlertCurrentPredicate() throws Exception { AlertDefinitionEntity definition = m_definitionDao.findByName( m_cluster.getClusterId(), "Alert Definition 0"); @@ -420,7 +417,6 @@ public class AlertsDAOTest { * @throws Exception */ @Test - @Ignore public void testAlertCurrentUpdatesViaHistory() throws Exception { AlertDefinitionEntity hostDef = new AlertDefinitionEntity(); hostDef.setDefinitionName("Host Alert Definition "); @@ -463,7 +459,6 @@ public class AlertsDAOTest { * */ @Test - @Ignore public void testFindByState() { List<AlertState> allStates = new ArrayList<AlertState>(); allStates.add(AlertState.OK); @@ -495,7 +490,6 @@ public class AlertsDAOTest { * */ @Test - @Ignore public void testFindByDate() { calendar.clear(); calendar.set(2014, Calendar.JANUARY, 1); @@ -535,7 +529,6 @@ public class AlertsDAOTest { } @Test - @Ignore public void testFindCurrentByHostAndName() throws Exception { AlertCurrentEntity entity = m_dao.findCurrentByHostAndName( m_cluster.getClusterId(), "h2", "Alert Definition 1"); @@ -553,7 +546,6 @@ public class AlertsDAOTest { * */ @Test - @Ignore public void testFindCurrentSummary() throws Exception { AlertSummaryDTO summary = m_dao.findCurrentCounts(m_cluster.getClusterId(), null, null); @@ -661,7 +653,6 @@ public class AlertsDAOTest { * */ @Test - @Ignore public void testFindCurrentHostSummary() throws Exception { // start out with 1 since all alerts are for a single host and are OK AlertHostSummaryDTO summary = m_dao.findCurrentHostCounts(m_cluster.getClusterId()); @@ -767,7 +758,6 @@ public class AlertsDAOTest { } @Test - @Ignore public void testFindAggregates() throws Exception { // definition AlertDefinitionEntity definition = new AlertDefinitionEntity(); @@ -855,7 +845,6 @@ public class AlertsDAOTest { * entity to be stale. */ @Test - @Ignore public void testJPAInnerEntityStaleness() { List<AlertCurrentEntity> currents = m_dao.findCurrent(); AlertCurrentEntity current = currents.get(0); @@ -913,7 +902,6 @@ public class AlertsDAOTest { * @throws Exception */ @Test - @Ignore public void testMaintenanceMode() throws Exception { m_helper.installHdfsService(m_cluster, m_serviceFactory, m_componentFactory, m_schFactory, HOSTNAME); @@ -1103,7 +1091,6 @@ public class AlertsDAOTest { * @throws Exception */ @Test - @Ignore public void testAlertHistoryPredicate() throws Exception { m_helper.installHdfsService(m_cluster, m_serviceFactory, m_componentFactory, m_schFactory, HOSTNAME); @@ -1197,7 +1184,6 @@ public class AlertsDAOTest { * @throws Exception */ @Test - @Ignore public void testAlertHistoryPagination() throws Exception { m_helper.installHdfsService(m_cluster, m_serviceFactory, m_componentFactory, m_schFactory, HOSTNAME); @@ -1238,7 +1224,6 @@ public class AlertsDAOTest { * @throws Exception */ @Test - @Ignore public void testAlertHistorySorting() throws Exception { m_helper.installHdfsService(m_cluster, m_serviceFactory, m_componentFactory, m_schFactory, HOSTNAME); @@ -1298,7 +1283,6 @@ public class AlertsDAOTest { } @Test - @Ignore public void testRemoveCurrenyByService() throws Exception { List<AlertCurrentEntity> currentAlerts = m_dao.findCurrent(); assertNotNull(currentAlerts); @@ -1315,7 +1299,6 @@ public class AlertsDAOTest { } @Test - @Ignore public void testRemoveCurrenyByHost() throws Exception { List<AlertCurrentEntity> currentAlerts = m_dao.findCurrent(); assertNotNull(currentAlerts); @@ -1333,7 +1316,6 @@ public class AlertsDAOTest { } @Test - @Ignore public void testRemoveCurrenyByComponentHost() throws Exception { List<AlertCurrentEntity> currentAlerts = m_dao.findCurrent(); assertNotNull(currentAlerts); @@ -1354,7 +1336,6 @@ public class AlertsDAOTest { } @Test - @Ignore public void testRemoveCurrentDisabled() throws Exception { List<AlertCurrentEntity> currentAlerts = m_dao.findCurrent(); assertNotNull(currentAlerts); http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java index 1bc6436..4048635 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java @@ -26,6 +26,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import com.google.inject.persist.UnitOfWork; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.ServiceComponentNotFoundException; import org.apache.ambari.server.ServiceNotFoundException; @@ -66,7 +67,6 @@ import org.apache.ambari.server.state.State; import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import com.google.gson.Gson; @@ -122,10 +122,12 @@ public class UpgradeActionTest { m_injector = Guice.createInjector(new InMemoryDefaultTestModule()); m_injector.getInstance(GuiceJpaInitializer.class); m_injector.injectMembers(this); + m_injector.getInstance(UnitOfWork.class).begin(); } @After public void teardown() throws Exception { + m_injector.getInstance(UnitOfWork.class).end(); m_injector.getInstance(PersistService.class).stop(); } @@ -376,7 +378,6 @@ public class UpgradeActionTest { } @Test - @Ignore public void testFinalizeUpgradeAcrossStacks() throws Exception { makeCrossStackUpgradeCluster(); @@ -425,7 +426,6 @@ public class UpgradeActionTest { * @throws Exception */ @Test - @Ignore public void testFinalizeDowngradeAcrossStacks() throws Exception { makeCrossStackUpgradeCluster(); http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java index 31b707a..f3694c9 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java @@ -38,7 +38,6 @@ import org.apache.ambari.server.state.StackId; import org.apache.ambari.server.utils.EventBusSynchronizer; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import com.google.common.eventbus.EventBus; @@ -118,7 +117,6 @@ public class InitialAlertEventTest { * @throws Exception */ @Test - @Ignore public void testInitialAlertEvent() throws Exception { // ensure there are no historical items Assert.assertEquals(0, m_alertsDao.findAll().size()); http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/AlertDataManagerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/AlertDataManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/AlertDataManagerTest.java index aa6f1df..67c08ba 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/AlertDataManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/AlertDataManagerTest.java @@ -29,6 +29,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; +import com.google.inject.persist.UnitOfWork; import org.apache.ambari.server.events.AlertEvent; import org.apache.ambari.server.events.AlertReceivedEvent; import org.apache.ambari.server.events.AlertStateChangeEvent; @@ -68,7 +69,6 @@ import org.apache.ambari.server.state.alert.SourceType; import org.apache.ambari.server.utils.EventBusSynchronizer; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import com.google.common.eventbus.Subscribe; @@ -106,6 +106,8 @@ public class AlertDataManagerTest { public void setup() throws Exception { m_injector = Guice.createInjector(new InMemoryDefaultTestModule()); m_injector.getInstance(GuiceJpaInitializer.class); + m_injector.getInstance(UnitOfWork.class).begin(); + m_helper = m_injector.getInstance(OrmTestHelper.class); m_dao = m_injector.getInstance(AlertsDAO.class); m_dispatchDao = m_injector.getInstance(AlertDispatchDAO.class); @@ -141,12 +143,12 @@ public class AlertDataManagerTest { @After public void teardown() { + m_injector.getInstance(UnitOfWork.class).end(); m_injector.getInstance(PersistService.class).stop(); m_injector = null; } @Test - @Ignore public void testAlertRecords() { Alert alert1 = new Alert(ALERT_DEFINITION, null, SERVICE, COMPONENT, HOST1, AlertState.OK); @@ -265,7 +267,6 @@ public class AlertDataManagerTest { * @throws Exception */ @Test - @Ignore public void testAlertNotices() throws Exception { List<AlertNoticeEntity> notices = m_dispatchDao.findAllNotices(); assertEquals( 0, notices.size() ); http://git-wip-us.apache.org/repos/asf/ambari/blob/2e64b3b9/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java index 677ee1a..380b3bd 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java @@ -43,6 +43,7 @@ import javax.persistence.EntityManager; import javax.persistence.RollbackException; import com.google.gson.Gson; +import com.google.inject.persist.UnitOfWork; import junit.framework.Assert; import org.apache.ambari.server.AmbariException; @@ -104,7 +105,6 @@ import org.apache.ambari.server.state.host.HostHealthyHeartbeatEvent; import org.apache.ambari.server.state.host.HostRegistrationRequestEvent; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -194,10 +194,12 @@ public class ClusterTest { hostComponentStateDAO = injector.getInstance(HostComponentStateDAO.class); repositoryVersionDAO = injector.getInstance(RepositoryVersionDAO.class); gson = injector.getInstance(Gson.class); + injector.getInstance(UnitOfWork.class).begin(); } @After public void teardown() { + injector.getInstance(UnitOfWork.class).end(); injector.getInstance(PersistService.class).stop(); } @@ -538,7 +540,6 @@ public class ClusterTest { } @Test - @Ignore public void testAddHost() throws Exception { createDefaultCluster(); clusters.addHost("h3"); @@ -553,7 +554,6 @@ public class ClusterTest { } @Test - @Ignore public void testGetHostState() throws Exception { createDefaultCluster(); @@ -561,7 +561,6 @@ public class ClusterTest { } @Test - @Ignore public void testSetHostState() throws Exception { createDefaultCluster(); @@ -571,7 +570,6 @@ public class ClusterTest { } @Test - @Ignore public void testHostEvent() throws Exception, InvalidStateTransitionException { createDefaultCluster(); @@ -622,7 +620,6 @@ public class ClusterTest { } @Test - @Ignore public void testBasicClusterSetup() throws Exception { StackId stackVersion = new StackId("HDP-1.2.0"); @@ -652,7 +649,6 @@ public class ClusterTest { } @Test - @Ignore public void testAddAndGetServices() throws Exception { createDefaultCluster(); @@ -698,7 +694,6 @@ public class ClusterTest { } @Test - @Ignore public void testGetServiceComponentHosts() throws Exception { createDefaultCluster(); @@ -744,7 +739,6 @@ public class ClusterTest { } @Test - @Ignore public void testGetAndSetConfigs() throws Exception { createDefaultCluster(); @@ -785,7 +779,6 @@ public class ClusterTest { } @Test - @Ignore public void testDesiredConfigs() throws Exception { createDefaultCluster(); @@ -859,7 +852,6 @@ public class ClusterTest { } @Test - @Ignore public void testConvertToResponse() throws Exception { createDefaultCluster(); @@ -914,7 +906,6 @@ public class ClusterTest { } @Test - @Ignore public void testDeleteService() throws Exception { createDefaultCluster(); @@ -938,7 +929,6 @@ public class ClusterTest { } @Test - @Ignore public void testGetHostsDesiredConfigs() throws Exception { createDefaultCluster(); @@ -970,7 +960,6 @@ public class ClusterTest { } @Test - @Ignore public void testProvisioningState() throws Exception { createDefaultCluster(); @@ -984,7 +973,6 @@ public class ClusterTest { } @Test - @Ignore public void testServiceConfigVersions() throws Exception { createDefaultCluster(); @@ -1048,7 +1036,6 @@ public class ClusterTest { } @Test - @Ignore public void testSingleServiceVersionForMultipleConfigs() throws Exception { createDefaultCluster(); @@ -1084,7 +1071,6 @@ public class ClusterTest { } @Test - @Ignore public void testServiceConfigVersionsForGroups() throws Exception { createDefaultCluster(); @@ -1182,7 +1168,6 @@ public class ClusterTest { } @Test - @Ignore public void testTransitionClusterVersion() throws Exception { createDefaultCluster(); @@ -1330,7 +1315,6 @@ public class ClusterTest { } @Test - @Ignore public void testTransitionClusterVersionTransactionFail() throws Exception { createDefaultCluster(); @@ -1359,7 +1343,6 @@ public class ClusterTest { } @Test - @Ignore public void testInferHostVersions() throws Exception { createDefaultCluster(); @@ -1420,7 +1403,6 @@ public class ClusterTest { } @Test - @Ignore public void testRecalculateClusterVersionState() throws Exception { createDefaultCluster(); @@ -1529,7 +1511,6 @@ public class ClusterTest { } @Test - @Ignore public void testRecalculateAllClusterVersionStates() throws Exception { createDefaultCluster(); @@ -1589,7 +1570,6 @@ public class ClusterTest { * @throws Exception */ @Test - @Ignore public void testTransitionHostVersionAdvanced() throws Exception { String clusterName = "c1"; String v1 = "2.2.0-123";
