@Test public void assertOnlyRunOnce() { Properties p = new Properties(); p.put(Config.FIRST_RUN, true); Configuration test = new MapConfiguration(p); SessionFactory mockFactory = Mockito.mock(SessionFactory.class); Container mockContainer = Mockito.mock(Container.class); ContainerLifecycleListener l = new FirstRunContainerLifecycleListener( mockFactory, test, new DatabaseMigrationState()); l.onStartup(mockContainer); Mockito.verifyNoMoreInteractions(mockFactory); Mockito.verifyNoMoreInteractions(mockContainer); }
@Override public void onStartup(final Container container) { Boolean firstRun = servletConfig.getBoolean(Config.FIRST_RUN, false); if (!firstRun) { bootstrapApplication(); servletConfig.addProperty(Config.FIRST_RUN, true); } }
FirstRunContainerLifecycleListener implements ContainerLifecycleListener { @Override public void onStartup(final Container container) { Boolean firstRun = servletConfig.getBoolean(Config.FIRST_RUN, false); if (!firstRun) { bootstrapApplication(); servletConfig.addProperty(Config.FIRST_RUN, true); } } }
FirstRunContainerLifecycleListener implements ContainerLifecycleListener { @Override public void onStartup(final Container container) { Boolean firstRun = servletConfig.getBoolean(Config.FIRST_RUN, false); if (!firstRun) { bootstrapApplication(); servletConfig.addProperty(Config.FIRST_RUN, true); } } @Inject  FirstRunContainerLifecycleListener(
            final SessionFactory sessionFactory,
            @Named(ServletConfigFactory.GROUP_NAME)
            final Configuration servletConfig,
            final DatabaseMigrationState migrationState); }
FirstRunContainerLifecycleListener implements ContainerLifecycleListener { @Override public void onStartup(final Container container) { Boolean firstRun = servletConfig.getBoolean(Config.FIRST_RUN, false); if (!firstRun) { bootstrapApplication(); servletConfig.addProperty(Config.FIRST_RUN, true); } } @Inject  FirstRunContainerLifecycleListener(
            final SessionFactory sessionFactory,
            @Named(ServletConfigFactory.GROUP_NAME)
            final Configuration servletConfig,
            final DatabaseMigrationState migrationState); @Override void onStartup(final Container container); @Override void onReload(final Container container); @Override void onShutdown(final Container container); }
FirstRunContainerLifecycleListener implements ContainerLifecycleListener { @Override public void onStartup(final Container container) { Boolean firstRun = servletConfig.getBoolean(Config.FIRST_RUN, false); if (!firstRun) { bootstrapApplication(); servletConfig.addProperty(Config.FIRST_RUN, true); } } @Inject  FirstRunContainerLifecycleListener(
            final SessionFactory sessionFactory,
            @Named(ServletConfigFactory.GROUP_NAME)
            final Configuration servletConfig,
            final DatabaseMigrationState migrationState); @Override void onStartup(final Container container); @Override void onReload(final Container container); @Override void onShutdown(final Container container);  }