Search in sources :

Example 1 with PersistenceEnv

use of org.opencastproject.util.persistencefn.PersistenceEnv in project opencast by opencast.

the class SchedulerServiceImplTest method mkAssetManager.

AssetManager mkAssetManager() throws Exception {
    final PersistenceEnv penv = PersistenceEnvs.mk(mkEntityManagerFactory("org.opencastproject.assetmanager.impl"));
    final Database db = new Database(penv);
    return new AbstractAssetManager() {

        @Override
        public HttpAssetProvider getHttpAssetProvider() {
            // identity provider
            return new HttpAssetProvider() {

                @Override
                public Snapshot prepareForDelivery(Snapshot snapshot) {
                    return snapshot;
                }
            };
        }

        @Override
        public Database getDb() {
            return db;
        }

        @Override
        protected Workspace getWorkspace() {
            return workspace;
        }

        @Override
        public AssetStore getAssetStore() {
            return mkAssetStore();
        }

        @Override
        protected String getCurrentOrgId() {
            return DefaultOrganization.DEFAULT_ORGANIZATION_ID;
        }
    };
}
Also used : Snapshot(org.opencastproject.assetmanager.api.Snapshot) HttpAssetProvider(org.opencastproject.assetmanager.impl.HttpAssetProvider) AbstractAssetManager(org.opencastproject.assetmanager.impl.AbstractAssetManager) PersistenceEnv(org.opencastproject.util.persistencefn.PersistenceEnv) Database(org.opencastproject.assetmanager.impl.persistence.Database)

Example 2 with PersistenceEnv

use of org.opencastproject.util.persistencefn.PersistenceEnv in project opencast by opencast.

the class TestTasksEndpoint method mkAssetManager.

AssetManager mkAssetManager(final Workspace workspace) throws Exception {
    final PersistenceEnv penv = PersistenceEnvs.mk(mkEntityManagerFactory("org.opencastproject.assetmanager.impl"));
    final Database db = new Database(penv);
    return new AbstractAssetManager() {

        @Override
        public HttpAssetProvider getHttpAssetProvider() {
            // identity provider
            return new HttpAssetProvider() {

                @Override
                public Snapshot prepareForDelivery(Snapshot snapshot) {
                    return snapshot;
                }
            };
        }

        @Override
        public Database getDb() {
            return db;
        }

        @Override
        protected Workspace getWorkspace() {
            return workspace;
        }

        @Override
        public AssetStore getAssetStore() {
            return mkAssetStore(workspace);
        }

        @Override
        protected String getCurrentOrgId() {
            return DefaultOrganization.DEFAULT_ORGANIZATION_ID;
        }
    };
}
Also used : Snapshot(org.opencastproject.assetmanager.api.Snapshot) HttpAssetProvider(org.opencastproject.assetmanager.impl.HttpAssetProvider) AbstractAssetManager(org.opencastproject.assetmanager.impl.AbstractAssetManager) PersistenceEnv(org.opencastproject.util.persistencefn.PersistenceEnv) Database(org.opencastproject.assetmanager.impl.persistence.Database)

Aggregations

Snapshot (org.opencastproject.assetmanager.api.Snapshot)2 AbstractAssetManager (org.opencastproject.assetmanager.impl.AbstractAssetManager)2 HttpAssetProvider (org.opencastproject.assetmanager.impl.HttpAssetProvider)2 Database (org.opencastproject.assetmanager.impl.persistence.Database)2 PersistenceEnv (org.opencastproject.util.persistencefn.PersistenceEnv)2