本文整理汇总了TypeScript中container-ts.Container类的典型用法代码示例。如果您正苦于以下问题:TypeScript Container类的具体用法?TypeScript Container怎么用?TypeScript Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Container类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: init
init(db) {
this.container = ContainerBuilder.create();
this.setupRepositories(db);
this.setupRestServices();
if(this.args.mockGit) {
this.container.add(new auth.MockAuthenticationService(), 'authenticationService');
this.container.add(new github.GitServiceFactoryMock(), 'gitServiceFactory');
} else {
this.container.add(new auth.GithubAuthenticationService(), 'authenticationService');
this.container.add(new github.GithubServiceFactory(), 'gitServiceFactory');
}
this.container.add(new PersistedBuildQueue(), 'buildQueue');
this.container.add(new BuildRequestController(), 'buildRequestController');
this.container.add(new PipelineController(), 'pipelineController');
this.container.add(new BuildResultController(), 'buildResultController');
this.container.add(new api.ExpressServer(), 'expressServer');
this.container.init();
}
示例2: setupRepositories
private setupRepositories(db) {
this.container.add(new repository.MongoDBRepository<model.UserCredentialsSchema>('user_credentials', db), 'userCredentialsRepository');
this.container.add(new repository.MongoDBRepository<model.RepositorySchema>('repositories', db), 'repositoriesRepository');
this.container.add(new repository.MongoDBRepository<model.BuildSchema>('builds', db), 'queuedBuildsRepository');
this.container.add(new repository.MongoDBRepository<model.DependencyGraphSchema>('dependency_graphs', db), 'dependencyGraphsRepository');
this.container.add(new repository.MongoDBRepository<model.PipelineSchema>('pipelines', db), 'pipelinesRepository');
}
示例3: debugUpdatePipelineAsFinishedSuccesfully
async debugUpdatePipelineAsFinishedSuccesfully(id : string) : Promise<void> {
let pipeline = await this.getPipeline(parseInt(id));
pipeline.status = model.PipelineStatus.SUCCESS;
let repo : repository.DocumentRepositoryQ<model.PipelineSchema> = this._app.get('pipelinesRepository');
expect(repo).not.to.be.null;
await repo.updateQ({_id : pipeline._id}, pipeline);
let finishedPipelines = await this.getFinishedPipelines();
expect(finishedPipelines.some(x => x._id == id))
}
示例4: setupRestServices
private setupRestServices() {
this.container.add(new api.ExpressServer(), 'expressServer');
this.container.add(new Repositories(), 'rest.Repositories');
this.container.add(new Ping(), 'rest.Ping');
this.container.add(new Builds(), 'rest.Builds');
this.container.add(new DependencyGraphs(), 'rest.DependencyGraphs');
this.container.add(new Pipelines(), 'rest.Pipelines');
this.container.add(new BuildRequests(), 'rest.BuildRequests');
}
示例5: stop
stop() {
let server : api.ExpressServer = this.container.get('expressServer');
server.stop();
}
示例6: getComponent
getComponent(id : string) : any {
return this.container.get(id);
}