File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
main/java/org/jooby/ebean
test/java/org/jooby/ebean Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,11 @@ public class Ebeanby extends Jdbc {
149149
150150 private Set <String > packages = new HashSet <>();
151151
152+ static {
153+ // Turn off ebean shutdown hook:
154+ System .setProperty ("ebean.registerShutdownHook" , "false" );
155+ }
156+
152157 /**
153158 * Creates a new {@link Ebeanby} using the given name to setup a {@link Jdbc} datasource.
154159 *
Original file line number Diff line number Diff line change 1+ package org .jooby .ebean ;
2+
3+ import static org .easymock .EasyMock .expect ;
4+
5+ import org .jooby .test .MockUnit ;
6+ import org .junit .Test ;
7+ import org .junit .runner .RunWith ;
8+ import org .powermock .core .classloader .annotations .PrepareForTest ;
9+ import org .powermock .modules .junit4 .PowerMockRunner ;
10+
11+ @ RunWith (PowerMockRunner .class )
12+ @ PrepareForTest ({Ebeanby .class , System .class })
13+ public class Issue589 {
14+
15+ @ Test
16+ public void shouldTurnOffEbeanShutdownHook () throws Exception {
17+ new MockUnit ()
18+ .expect (unit -> {
19+ unit .mockStatic (System .class );
20+ expect (System .setProperty ("ebean.registerShutdownHook" , "false" )).andReturn (null );
21+ })
22+ .run (unit -> {
23+ new Ebeanby ();
24+ });
25+ }
26+
27+ }
You can’t perform that action at this time.
0 commit comments