File tree Expand file tree Collapse file tree 4 files changed +3
-36
lines changed
main/java/org/apache/cloudstack/framework/extensions
test/java/org/apache/cloudstack/framework/extensions/dao Expand file tree Collapse file tree 4 files changed +3
-36
lines changed Original file line number Diff line number Diff line change 1616// under the License.
1717package org .apache .cloudstack .framework .extensions .dao ;
1818
19- import java . util . List ;
19+ import org . apache . cloudstack . framework . extensions . vo . ExtensionVO ;
2020
2121import com .cloud .utils .db .GenericDao ;
22- import org .apache .cloudstack .framework .extensions .vo .ExtensionVO ;
2322
2423public interface ExtensionDao extends GenericDao <ExtensionVO , Long > {
2524
2625 ExtensionVO findByName (String name );
27- List <ExtensionVO > listAllEnabled ();
2826}
Original file line number Diff line number Diff line change 1717
1818package org .apache .cloudstack .framework .extensions .dao ;
1919
20- import java . util . List ;
20+ import org . apache . cloudstack . framework . extensions . vo . ExtensionVO ;
2121
2222import com .cloud .utils .db .GenericDaoBase ;
2323import com .cloud .utils .db .SearchBuilder ;
2424import com .cloud .utils .db .SearchCriteria ;
2525
26- import org .apache .cloudstack .extension .Extension ;
27- import org .apache .cloudstack .framework .extensions .vo .ExtensionVO ;
28-
2926public 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}
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 1919
2020import static org .junit .Assert .assertEquals ;
2121import static org .junit .Assert .assertNull ;
22- import static org .junit .Assert .assertTrue ;
2322import static org .mockito .Mockito .mock ;
2423import static org .mockito .Mockito .when ;
2524
26- import java .util .List ;
27-
28- import org .apache .cloudstack .extension .Extension ;
2925import org .apache .cloudstack .framework .extensions .vo .ExtensionVO ;
3026import org .junit .Before ;
3127import 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}
You can’t perform that action at this time.
0 commit comments