Skip to content
Permalink
Browse files
AMBARI-25084. Delete identities fails when removing service in revers…
…e order (amagyar) (#2751)
  • Loading branch information
zeroflag committed Jan 4, 2019
1 parent 1b58df7 commit ecce21178c9f3612dca8354b9874e16ec7702078
Showing 2 changed files with 7 additions and 0 deletions.
@@ -19,6 +19,7 @@
package org.apache.ambari.server.orm.dao;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

import javax.persistence.EntityManager;
@@ -223,6 +224,9 @@ public List<ClusterConfigEntity> getLatestConfigurations(long clusterId,
@RequiresSession
public List<ClusterConfigEntity> getLatestConfigurationsWithTypes(long clusterId, StackId stackId, Collection<String> configTypes) {
StackEntity stackEntity = stackDAO.find(stackId.getStackName(), stackId.getStackVersion());
if (configTypes.isEmpty()) {
return Collections.emptyList();
}
return daoUtils.selectList(
entityManagerProvider.get()
.createNamedQuery("ClusterConfigEntity.findLatestConfigsByStackWithTypes", ClusterConfigEntity.class)
@@ -22,6 +22,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;

@@ -492,6 +493,8 @@ public void testGetLatestClusterConfigsWithTypes() throws Exception {
Assert.assertEquals(1, entities.size());
entities = clusterDAO.getLatestConfigurationsWithTypes(clusterEntity.getClusterId(), HDP_01, asList("no-such-type"));
Assert.assertTrue(entities.isEmpty());
entities = clusterDAO.getLatestConfigurationsWithTypes(clusterEntity.getClusterId(), HDP_01, Collections.emptyList());
Assert.assertTrue(entities.isEmpty());
}

/**

0 comments on commit ecce211

Please sign in to comment.