Search in sources :

Example 1 with DeploymentConfiguration

use of org.activityinfo.server.DeploymentConfiguration in project activityinfo by bedatadriven.

the class ConfigModule method provideDeploymentConfig.

@Provides
@Singleton
public DeploymentConfiguration provideDeploymentConfig(ServletContext context) {
    Properties properties = new Properties();
    tryToLoadFrom(properties, webInfDirectory(context));
    tryToLoadFrom(properties, systemSettings());
    tryToLoadFrom(properties, userSettings());
    if (DeploymentEnvironment.isAppEngine()) {
        tryToLoadFromAppEngineDatastore(properties);
        tryToLoadFromDefaultBucket(properties);
    }
    // -Dactivityinfo.config=/path/to/conf.properties
    if (!Strings.isNullOrEmpty(System.getProperty("activityinfo.config"))) {
        tryToLoadFrom(properties, new File(System.getProperty("activityinfo.config")));
    }
    return new DeploymentConfiguration(properties);
}
Also used : Properties(java.util.Properties) File(java.io.File) DeploymentConfiguration(org.activityinfo.server.DeploymentConfiguration) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 2 with DeploymentConfiguration

use of org.activityinfo.server.DeploymentConfiguration in project activityinfo by bedatadriven.

the class ConfigModuleStub method provideDeploymentConfig.

@Provides
public DeploymentConfiguration provideDeploymentConfig() {
    Properties properties = new Properties();
    properties.setProperty(DeploymentConfiguration.BLOBSERVICE_GCS_BUCKET_NAME, "app_default_bucket");
    return new DeploymentConfiguration(properties);
}
Also used : Properties(java.util.Properties) DeploymentConfiguration(org.activityinfo.server.DeploymentConfiguration) Provides(com.google.inject.Provides)

Example 3 with DeploymentConfiguration

use of org.activityinfo.server.DeploymentConfiguration in project activityinfo by bedatadriven.

the class XFormResourceTest method setUp.

@Before
public void setUp() throws IOException {
    objectifyService = ObjectifyService.begin();
    Provider<AuthenticatedUser> authProvider = Providers.of(new AuthenticatedUser("", USER_ID, "jorden@bdd.com"));
    resourceLocator = new ResourceLocatorSyncImpl(injector.getProvider(FormStorageProvider.class), authProvider, new PermissionOracle(injector.getProvider(EntityManager.class)), new BlobAuthorizerStub());
    OdkFormFieldBuilderFactory fieldFactory = new OdkFormFieldBuilderFactory(resourceLocator);
    AuthTokenProvider tokenService = new AuthTokenProvider();
    TestBlobstoreService blobstore = new TestBlobstoreService(injector.getInstance(DeploymentConfiguration.class), injector.getInstance(EntityManager.class));
    TestInstanceIdService idService = new TestInstanceIdService();
    SubmissionArchiver backupService = new SubmissionArchiver(new DeploymentConfiguration(new Properties()));
    formResource = new XFormResources(resourceLocator, authProvider, fieldFactory, tokenService);
    formSubmissionResource = new XFormSubmissionResource(getDispatcherSync(), resourceLocator, tokenService, blobstore, idService, backupService);
}
Also used : PermissionOracle(org.activityinfo.server.command.handler.PermissionOracle) Properties(java.util.Properties) AuthenticatedUser(org.activityinfo.legacy.shared.AuthenticatedUser) EntityManager(javax.persistence.EntityManager) BlobAuthorizerStub(org.activityinfo.store.spi.BlobAuthorizerStub) DeploymentConfiguration(org.activityinfo.server.DeploymentConfiguration) Before(org.junit.Before)

Example 4 with DeploymentConfiguration

use of org.activityinfo.server.DeploymentConfiguration in project activityinfo by bedatadriven.

the class HostControllerTest method setup.

@Before
public void setup() {
    DeploymentConfiguration deploymentConfig = new DeploymentConfiguration(new Properties());
    authProvider = new ServerSideAuthProvider();
    authProvider.clear();
    entityManager = createMock(EntityManager.class);
    expect(entityManager.find(User.class, 3)).andReturn(new User()).anyTimes();
    replay(entityManager);
    resource = new HostController(authProvider, Providers.of(entityManager));
}
Also used : ServerSideAuthProvider(org.activityinfo.server.authentication.ServerSideAuthProvider) EntityManager(javax.persistence.EntityManager) User(org.activityinfo.server.database.hibernate.entity.User) AuthenticatedUser(org.activityinfo.legacy.shared.AuthenticatedUser) Properties(java.util.Properties) DeploymentConfiguration(org.activityinfo.server.DeploymentConfiguration) Before(org.junit.Before)

Example 5 with DeploymentConfiguration

use of org.activityinfo.server.DeploymentConfiguration in project activityinfo by bedatadriven.

the class PostmarkMailSenderTest method setUp.

@Before
public void setUp() throws TemplateModelException {
    Properties properties = new Properties();
    properties.setProperty(PostmarkMailSender.POSTMARK_API_KEY, "POSTMARK_API_TEST");
    DeploymentConfiguration config = new DeploymentConfiguration(properties);
    TemplateModule templateModule = new TemplateModule();
    sender = new PostmarkMailSender(config, templateModule.provideConfiguration(Providers.of(Domain.DEFAULT)));
}
Also used : TemplateModule(org.activityinfo.server.util.TemplateModule) Properties(java.util.Properties) DeploymentConfiguration(org.activityinfo.server.DeploymentConfiguration) Before(org.junit.Before)

Aggregations

Properties (java.util.Properties)5 DeploymentConfiguration (org.activityinfo.server.DeploymentConfiguration)5 Before (org.junit.Before)3 Provides (com.google.inject.Provides)2 EntityManager (javax.persistence.EntityManager)2 AuthenticatedUser (org.activityinfo.legacy.shared.AuthenticatedUser)2 Singleton (com.google.inject.Singleton)1 File (java.io.File)1 ServerSideAuthProvider (org.activityinfo.server.authentication.ServerSideAuthProvider)1 PermissionOracle (org.activityinfo.server.command.handler.PermissionOracle)1 User (org.activityinfo.server.database.hibernate.entity.User)1 TemplateModule (org.activityinfo.server.util.TemplateModule)1 BlobAuthorizerStub (org.activityinfo.store.spi.BlobAuthorizerStub)1