Skip to content

Commit 35f779b

Browse files
committed
list all for sync check
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent af19e3c commit 35f779b

File tree

4 files changed

+3
-36
lines changed

4 files changed

+3
-36
lines changed

framework/extensions/src/main/java/org/apache/cloudstack/framework/extensions/dao/ExtensionDao.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
// under the License.
1717
package org.apache.cloudstack.framework.extensions.dao;
1818

19-
import java.util.List;
19+
import org.apache.cloudstack.framework.extensions.vo.ExtensionVO;
2020

2121
import com.cloud.utils.db.GenericDao;
22-
import org.apache.cloudstack.framework.extensions.vo.ExtensionVO;
2322

2423
public interface ExtensionDao extends GenericDao<ExtensionVO, Long> {
2524

2625
ExtensionVO findByName(String name);
27-
List<ExtensionVO> listAllEnabled();
2826
}

framework/extensions/src/main/java/org/apache/cloudstack/framework/extensions/dao/ExtensionDaoImpl.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717

1818
package org.apache.cloudstack.framework.extensions.dao;
1919

20-
import java.util.List;
20+
import org.apache.cloudstack.framework.extensions.vo.ExtensionVO;
2121

2222
import com.cloud.utils.db.GenericDaoBase;
2323
import com.cloud.utils.db.SearchBuilder;
2424
import com.cloud.utils.db.SearchCriteria;
2525

26-
import org.apache.cloudstack.extension.Extension;
27-
import org.apache.cloudstack.framework.extensions.vo.ExtensionVO;
28-
2926
public class ExtensionDaoImpl extends GenericDaoBase<ExtensionVO, Long> implements ExtensionDao {
3027

3128
private final SearchBuilder<ExtensionVO> AllFieldSearch;
@@ -45,11 +42,4 @@ public ExtensionVO findByName(String name) {
4542

4643
return findOneBy(sc);
4744
}
48-
49-
@Override
50-
public List<ExtensionVO> listAllEnabled() {
51-
SearchCriteria<ExtensionVO> sc = AllFieldSearch.create();
52-
sc.setParameters("state", Extension.State.Enabled);
53-
return listBy(sc);
54-
}
5545
}

framework/extensions/src/main/java/org/apache/cloudstack/framework/extensions/manager/ExtensionsManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ protected void runCleanupForLongestRunningManagementServer() {
15161516
logger.debug("Skipping the extensions entrypoint sync check on this management server");
15171517
return;
15181518
}
1519-
List<ExtensionVO> extensions = extensionDao.listAllEnabled();
1519+
List<ExtensionVO> extensions = extensionDao.listAll();
15201520
for (ExtensionVO extension : extensions) {
15211521
checkExtensionEntryPointSync(extension, msHosts);
15221522
}

framework/extensions/src/test/java/org/apache/cloudstack/framework/extensions/dao/ExtensionDaoImplTest.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@
1919

2020
import static org.junit.Assert.assertEquals;
2121
import static org.junit.Assert.assertNull;
22-
import static org.junit.Assert.assertTrue;
2322
import static org.mockito.Mockito.mock;
2423
import static org.mockito.Mockito.when;
2524

26-
import java.util.List;
27-
28-
import org.apache.cloudstack.extension.Extension;
2925
import org.apache.cloudstack.framework.extensions.vo.ExtensionVO;
3026
import org.junit.Before;
3127
import org.junit.Test;
@@ -52,21 +48,4 @@ public void findByNameReturnsCorrectEntity() {
5248
when(dao.findByName("extensionName")).thenReturn(expected);
5349
assertEquals(expected, dao.findByName("extensionName"));
5450
}
55-
56-
@Test
57-
public void listAllEnabledReturnsEmptyListWhenNoEnabledExtensions() {
58-
when(dao.listAllEnabled()).thenReturn(List.of());
59-
assertTrue(dao.listAllEnabled().isEmpty());
60-
}
61-
62-
@Test
63-
public void listAllEnabledReturnsCorrectEntities() {
64-
ExtensionVO enabled1 = new ExtensionVO();
65-
enabled1.setState(Extension.State.Enabled);
66-
ExtensionVO enabled2 = new ExtensionVO();
67-
enabled2.setState(Extension.State.Enabled);
68-
List<ExtensionVO> expected = List.of(enabled1, enabled2);
69-
when(dao.listAllEnabled()).thenReturn(expected);
70-
assertEquals(expected, dao.listAllEnabled());
71-
}
7251
}

0 commit comments

Comments
 (0)