// Path: authrite-service/src/main/java/com/lewisd/authrite/AuthriteServiceApplication.java
// public class AuthriteServiceApplication extends Application<AuthriteServiceConfiguration> {
// 
//     // Set to `false` for development, true elsewhere.
//     // `false` will load assets from src/main/resources, allowing a fast edit-reload cycle.
//     private final boolean useClasspathAssets = Boolean.parseBoolean(System.getProperty("authrite.assets.useClasspath", "true"));
// 
//     public static void main(final String[] args) throws Exception {
//         new AuthriteServiceApplication().run(args);
//     }
// 
//     @Override
//     public String getName() {
//         return "authrite-service";
//     }
// 
//     @Override
//     public void initialize(final Bootstrap<AuthriteServiceConfiguration> bootstrap) {
//         bootstrap.addBundle(new Java8Bundle());
// 
//         if (useClasspathAssets) {
//             bootstrap.addBundle(new AssetsBundle("/assets/", "/"));
//         } else {
//             bootstrap.addBundle(new FileAssetsBundle("src/main/resources/assets", "/"));
//         }
// 
//         bootstrap.addBundle(new MigrationsBundle<AuthriteServiceConfiguration>() {
//             @Override
//             public DataSourceFactory getDataSourceFactory(final AuthriteServiceConfiguration configuration) {
//                 return configuration.getDatabase();
//             }
//         });
//     }
// 
//     @Override
//     public void run(final AuthriteServiceConfiguration configuration,
//                     final Environment environment) {
// 
//         final DBIFactory factory = new DBIFactory();
//         final DBI dbi = factory.build(environment, configuration.getDatabase(), "h2");
//         final JWTConfiguration jwtConfiguration = configuration.getJwt();
//         final JwtTokenManager jwtTokenManager = jwtConfiguration.buildTokenManager();
//         final PasswordManagementConfiguration passwordManagement = configuration.getPasswordManagement();
//         final UsersService usersService = new UsersService(dbi, jwtTokenManager, passwordManagement);
//         final UsersResource usersResource = new UsersResource(usersService, jwtConfiguration);
//         environment.jersey().register(usersResource);
// 
//         final PlayersResource playersResource = new PlayersResource(dbi);
//         environment.jersey().register(playersResource);
// 
//         environment.jersey().register(new AuthDynamicFeature(jwtConfiguration.buildAuthFilter()));
//         environment.jersey().register(RolesAllowedDynamicFeature.class);
// 
//         //Required to use @Auth to inject a custom Principal type into your resource
//         environment.jersey().register(new AuthValueFactoryProvider.Binder<>(User.class));
//     }
// 
// }
// 
// Path: authrite-service/src/main/java/com/lewisd/authrite/AuthriteServiceConfiguration.java
// public class AuthriteServiceConfiguration extends Configuration {
// 
//     @Valid
//     @NotNull
//     private JWTConfiguration jwt = new JWTConfiguration();
// 
//     @Valid
//     @NotNull
//     private DataSourceFactory database = new DataSourceFactory();
// 
//     @Valid
//     @NotNull
//     private PasswordManagementConfiguration passwordManagement = new PasswordManagementConfiguration();
// 
//     @JsonProperty
//     public JWTConfiguration getJwt() {
//         return jwt;
//     }
// 
//     @JsonProperty
//     public void setJwt(final JWTConfiguration jwt) {
//         this.jwt = jwt;
//     }
// 
//     @JsonProperty
//     public DataSourceFactory getDatabase() {
//         return database;
//     }
// 
//     @JsonProperty
//     public void setDatabase(final DataSourceFactory database) {
//         this.database = database;
//     }
// 
//     @JsonProperty
//     public PasswordManagementConfiguration getPasswordManagement() {
//         return passwordManagement;
//     }
// 
//     @JsonProperty
//     public void setPasswordManagement(final PasswordManagementConfiguration passwordManagement) {
//         this.passwordManagement = passwordManagement;
//     }
// }
// 
// Path: authrite-acctests/src/main/java/com/lewisd/authrite/acctests/framework/database/H2DatabaseContext.java
// public class H2DatabaseContext extends DatabaseContext {
// 
//     @Override
//     public String databaseUrl() {
//         return "jdbc:h2:./target/" + databaseName();
//     }
// 
//     @Override
//     public TestRule rules() {
//         // Don't chain because we don't need the TemporaryDatabaseRule for H2.
//         return makeMigrationRule();
//     }
// 
//     private MigrateDatabaseRule makeMigrationRule() {
//         return new MigrateDatabaseRule(databaseUrl(), username(), password());
//     }
// 
//     @Override
//     protected String defaultPassword() {
//         return "sa";
//     }
// 
//     @Override
//     protected String defaultUsername() {
//         return "sa";
//     }
// }


import com.lewisd.authrite.AuthriteServiceApplication;
import com.lewisd.authrite.AuthriteServiceConfiguration;
import com.lewisd.authrite.acctests.framework.database.H2DatabaseContext;
import io.dropwizard.testing.ConfigOverride;
import io.dropwizard.testing.junit.DropwizardAppRule;
import io.github.unacceptable.database.DatabaseContext;
import io.github.unacceptable.lazy.Lazily;
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
package com.lewisd.authrite.acctests.framework.driver;


public class SystemDriver {
    private static final ConfigOverride LOG_THRESHOLD = ConfigOverride.config("logging.level", System.getProperty("app.logging.threshold", "INFO"));
    private static final String ACCTEST_BASEURI_PROPERTY = "acctest.baseuri";

    private final DatabaseContext databaseContext = new H2DatabaseContext();

// Path: authrite-service/src/main/java/com/lewisd/authrite/AuthriteServiceApplication.java
// public class AuthriteServiceApplication extends Application<AuthriteServiceConfiguration> {
// 
//     // Set to `false` for development, true elsewhere.
//     // `false` will load assets from src/main/resources, allowing a fast edit-reload cycle.
//     private final boolean useClasspathAssets = Boolean.parseBoolean(System.getProperty("authrite.assets.useClasspath", "true"));
// 
//     public static void main(final String[] args) throws Exception {
//         new AuthriteServiceApplication().run(args);
//     }
// 
//     @Override
//     public String getName() {
//         return "authrite-service";
//     }
// 
//     @Override
//     public void initialize(final Bootstrap<AuthriteServiceConfiguration> bootstrap) {
//         bootstrap.addBundle(new Java8Bundle());
// 
//         if (useClasspathAssets) {
//             bootstrap.addBundle(new AssetsBundle("/assets/", "/"));
//         } else {
//             bootstrap.addBundle(new FileAssetsBundle("src/main/resources/assets", "/"));
//         }
// 
//         bootstrap.addBundle(new MigrationsBundle<AuthriteServiceConfiguration>() {
//             @Override
//             public DataSourceFactory getDataSourceFactory(final AuthriteServiceConfiguration configuration) {
//                 return configuration.getDatabase();
//             }
//         });
//     }
// 
//     @Override
//     public void run(final AuthriteServiceConfiguration configuration,
//                     final Environment environment) {
// 
//         final DBIFactory factory = new DBIFactory();
//         final DBI dbi = factory.build(environment, configuration.getDatabase(), "h2");
//         final JWTConfiguration jwtConfiguration = configuration.getJwt();
//         final JwtTokenManager jwtTokenManager = jwtConfiguration.buildTokenManager();
//         final PasswordManagementConfiguration passwordManagement = configuration.getPasswordManagement();
//         final UsersService usersService = new UsersService(dbi, jwtTokenManager, passwordManagement);
//         final UsersResource usersResource = new UsersResource(usersService, jwtConfiguration);
//         environment.jersey().register(usersResource);
// 
//         final PlayersResource playersResource = new PlayersResource(dbi);
//         environment.jersey().register(playersResource);
// 
//         environment.jersey().register(new AuthDynamicFeature(jwtConfiguration.buildAuthFilter()));
//         environment.jersey().register(RolesAllowedDynamicFeature.class);
// 
//         //Required to use @Auth to inject a custom Principal type into your resource
//         environment.jersey().register(new AuthValueFactoryProvider.Binder<>(User.class));
//     }
// 
// }
// 
// Path: authrite-service/src/main/java/com/lewisd/authrite/AuthriteServiceConfiguration.java
// public class AuthriteServiceConfiguration extends Configuration {
// 
//     @Valid
//     @NotNull
//     private JWTConfiguration jwt = new JWTConfiguration();
// 
//     @Valid
//     @NotNull
//     private DataSourceFactory database = new DataSourceFactory();
// 
//     @Valid
//     @NotNull
//     private PasswordManagementConfiguration passwordManagement = new PasswordManagementConfiguration();
// 
//     @JsonProperty
//     public JWTConfiguration getJwt() {
//         return jwt;
//     }
// 
//     @JsonProperty
//     public void setJwt(final JWTConfiguration jwt) {
//         this.jwt = jwt;
//     }
// 
//     @JsonProperty
//     public DataSourceFactory getDatabase() {
//         return database;
//     }
// 
//     @JsonProperty
//     public void setDatabase(final DataSourceFactory database) {
//         this.database = database;
//     }
// 
//     @JsonProperty
//     public PasswordManagementConfiguration getPasswordManagement() {
//         return passwordManagement;
//     }
// 
//     @JsonProperty
//     public void setPasswordManagement(final PasswordManagementConfiguration passwordManagement) {
//         this.passwordManagement = passwordManagement;
//     }
// }
// 
// Path: authrite-acctests/src/main/java/com/lewisd/authrite/acctests/framework/database/H2DatabaseContext.java
// public class H2DatabaseContext extends DatabaseContext {
// 
//     @Override
//     public String databaseUrl() {
//         return "jdbc:h2:./target/" + databaseName();
//     }
// 
//     @Override
//     public TestRule rules() {
//         // Don't chain because we don't need the TemporaryDatabaseRule for H2.
//         return makeMigrationRule();
//     }
// 
//     private MigrateDatabaseRule makeMigrationRule() {
//         return new MigrateDatabaseRule(databaseUrl(), username(), password());
//     }
// 
//     @Override
//     protected String defaultPassword() {
//         return "sa";
//     }
// 
//     @Override
//     protected String defaultUsername() {
//         return "sa";
//     }
// }


// Path: authrite-acctests/src/main/java/com/lewisd/authrite/acctests/framework/driver/SystemDriver.java
import com.lewisd.authrite.AuthriteServiceApplication;
import com.lewisd.authrite.AuthriteServiceConfiguration;
import com.lewisd.authrite.acctests.framework.database.H2DatabaseContext;
import io.dropwizard.testing.ConfigOverride;
import io.dropwizard.testing.junit.DropwizardAppRule;
import io.github.unacceptable.database.DatabaseContext;
import io.github.unacceptable.lazy.Lazily;
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

package com.lewisd.authrite.acctests.framework.driver;


public class SystemDriver {
    private static final ConfigOverride LOG_THRESHOLD = ConfigOverride.config("logging.level", System.getProperty("app.logging.threshold", "INFO"));
    private static final String ACCTEST_BASEURI_PROPERTY = "acctest.baseuri";

    private final DatabaseContext databaseContext = new H2DatabaseContext();

    private final DropwizardAppRule<AuthriteServiceConfiguration> appRule = new DropwizardAppRule<>(