当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript builder.ApplicationModelBuilder.createApplicationForTests方法代码示例

本文整理汇总了TypeScript中core/application/applicationModel.builder.ApplicationModelBuilder.createApplicationForTests方法的典型用法代码示例。如果您正苦于以下问题:TypeScript builder.ApplicationModelBuilder.createApplicationForTests方法的具体用法?TypeScript builder.ApplicationModelBuilder.createApplicationForTests怎么用?TypeScript builder.ApplicationModelBuilder.createApplicationForTests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core/application/applicationModel.builder.ApplicationModelBuilder的用法示例。


在下文中一共展示了builder.ApplicationModelBuilder.createApplicationForTests方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

  it('adds firewall names across accounts, falling back to the ID if none found', function() {
    let details: ISecurityGroupDetail = null;
    const application: Application = ApplicationModelBuilder.createApplicationForTests('app');
    application['securityGroupsIndex'] = {
      test: { 'us-east-1': { 'sg-2': { name: 'matched' } } },
      prod: { 'us-east-1': { 'sg-2': { name: 'matched-prod' } } },
    };

    $http.expectGET(`${API.baseUrl}/securityGroups/test/us-east-1/sg-123?provider=aws&vpcId=vpc-1`).respond(200, {
      inboundRules: [
        { securityGroup: { accountName: 'test', id: 'sg-345' } },
        { securityGroup: { accountName: 'test', id: 'sg-2' } },
        { securityGroup: { accountName: 'prod', id: 'sg-2' } },
      ],
      region: 'us-east-1',
    });

    reader
      .getSecurityGroupDetails(application, 'test', 'aws', 'us-east-1', 'vpc-1', 'sg-123')
      .then(result => (details = result));
    $http.flush();

    expect(details.securityGroupRules.length).toBe(3);
    expect(details.securityGroupRules[0].securityGroup.name).toBe('sg-345');
    expect(details.securityGroupRules[0].securityGroup.inferredName).toBe(true);
    expect(details.securityGroupRules[1].securityGroup.name).toBe('matched');
    expect(details.securityGroupRules[1].securityGroup.inferredName).toBeFalsy();
    expect(details.securityGroupRules[2].securityGroup.name).toBe('matched-prod');
    expect(details.securityGroupRules[2].securityGroup.inferredName).toBeFalsy();
  });
开发者ID:emjburns,项目名称:deck,代码行数:30,代码来源:securityGroupReader.service.spec.ts

示例2: it

    it('gets all accounts, then adds wildcard and regions per account to vm', () => {
      const accounts: any = [
        { name: 'prod', regions: [{ name: 'us-east-1' }, { name: 'us-west-1' }] },
        { name: 'test', regions: [{ name: 'us-west-2' }, { name: 'eu-west-1' }] },
      ];

      spyOn(AccountService, 'listAllAccounts').and.returnValue($q.when(accounts));

      initializeController(null);
      $ctrl.application = ApplicationModelBuilder.createApplicationForTests('app', {
        key: 'serverGroups',
        loader: () => $q.resolve([]),
        onLoad: (_app, data) => $q.resolve(data),
      });
      $ctrl.application.serverGroups.refresh();
      $scope.$digest();

      $ctrl.config = new ChaosMonkeyConfig($ctrl.application.attributes.chaosMonkey || {});

      $ctrl.$onInit();
      $scope.$digest();

      expect($ctrl.accounts).toEqual([accounts[0], accounts[1]]);
      expect($ctrl.regionsByAccount).toEqual({
        prod: ['*', 'us-east-1', 'us-west-1'],
        test: ['*', 'us-west-2', 'eu-west-1'],
      });
    });
开发者ID:emjburns,项目名称:deck,代码行数:28,代码来源:chaosMonkeyExceptions.component.spec.ts

示例3: beforeEach

 beforeEach(() => {
   application = ApplicationModelBuilder.createApplicationForTests(
     'app',
     {
       key: 'optionalSource',
       optional: true,
       visible: true,
     },
     {
       key: 'invisibleSource',
       visible: false,
     },
     {
       key: 'requiredSource',
       visible: true,
     },
     {
       key: 'optInSource',
       optional: true,
       visible: true,
       optIn: true,
     },
   );
   application.getDataSource('optInSource').disabled = true;
   application.attributes = { accounts: ['test'] };
 });
开发者ID:emjburns,项目名称:deck,代码行数:26,代码来源:applicationDataSourceEditor.component.spec.ts

示例4: it

    it('sets error when task fails while polling', () => {
      let completeCalled = false;
      const task = { id: 'a', status: 'RUNNING' } as ITask;
      OrchestratedItemTransformer.defineProperties(task);

      const operation = () => $q.when(task);
      const monitor = new TaskMonitor({
        application: ApplicationModelBuilder.createApplicationForTests('app', { key: 'runningTasks', lazy: true }),
        title: 'a task',
        modalInstance: { result: $q.defer().promise } as IModalServiceInstance,
        onTaskComplete: () => (completeCalled = true),
      });

      monitor.submit(operation);

      expect(monitor.submitting).toBe(true);
      expect(monitor.error).toBe(false);

      $timeout.flush(); // still running first time

      $http.expectGET([API.baseUrl, 'tasks', 'a'].join('/')).respond(200, { status: 'RUNNING' });
      $timeout.flush();
      $http.flush();
      expect(monitor.task.isCompleted).toBe(false);

      $http.expectGET([API.baseUrl, 'tasks', 'a'].join('/')).respond(200, { status: 'TERMINAL' });
      $timeout.flush(); // complete second time
      $http.flush();

      expect(monitor.submitting).toBe(false);
      expect(monitor.error).toBe(true);
      expect(monitor.errorMessage).toBe('There was an unknown server error.');
      expect(completeCalled).toBe(false);
    });
开发者ID:emjburns,项目名称:deck,代码行数:34,代码来源:taskMonitor.spec.ts

示例5: configureApplication

 function configureApplication() {
   ApplicationDataSourceRegistry.registerDataSource({ key: 'serverGroups' });
   application = ApplicationModelBuilder.createApplicationForTests(
     'app',
     ...ApplicationDataSourceRegistry.getDataSources(),
   );
   application.refresh();
   $scope.$digest();
 }
开发者ID:emjburns,项目名称:deck,代码行数:9,代码来源:pipeline.dataSource.spec.ts

示例6:

 this.buildApplication = (json: any) => {
   const app = ApplicationModelBuilder.createApplicationForTests('app', { key: 'serverGroups', lazy: true });
   if (json.serverGroups) {
     app.getDataSource('serverGroups').data = _.cloneDeep(json.serverGroups.data);
   }
   if (json.clusters) {
     app.clusters = json.clusters;
   }
   return app;
 };
开发者ID:emjburns,项目名称:deck,代码行数:10,代码来源:ClusterFilterService.spec.ts

示例7: beforeEach

 beforeEach(() => {
   const application: Application = ApplicationModelBuilder.createApplicationForTests(
     'app',
     ...ApplicationDataSourceRegistry.getDataSources(),
   );
   command = {
     viewState: {
       mode: 'create',
     },
     application: application.name,
   } as IServerGroupCommand;
 });
开发者ID:emjburns,项目名称:deck,代码行数:12,代码来源:serverGroupWriter.service.spec.ts

示例8: beforeEach

  beforeEach(() => {
    hasValue = false;
    accounts = [];
    delete SETTINGS.defaultProvider;

    application = ApplicationModelBuilder.createApplicationForTests('app');
    application.attributes = { cloudProviders: 'testProvider' };

    config = {
      name: 'testProvider',
      securityGroup: {},
    };
  });
开发者ID:emjburns,项目名称:deck,代码行数:13,代码来源:providerSelection.service.spec.ts


注:本文中的core/application/applicationModel.builder.ApplicationModelBuilder.createApplicationForTests方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。