本文整理汇总了TypeScript中core/application/applicationModel.builder.ApplicationModelBuilder类的典型用法代码示例。如果您正苦于以下问题:TypeScript builder.ApplicationModelBuilder类的具体用法?TypeScript builder.ApplicationModelBuilder怎么用?TypeScript builder.ApplicationModelBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了builder.ApplicationModelBuilder类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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'],
});
});
示例2:
(
$controller: ng.IControllerService,
$rootScope: ng.IRootScopeService,
_$q_: IQService,
applicationModelBuilder: ApplicationModelBuilder,
) => {
application = applicationModelBuilder.createStandaloneApplication('app');
$scope = $rootScope.$new();
$q = _$q_;
ctrl = $controller('ConfigurePipelineTemplateModalCtrl', {
$scope,
application,
$uibModalInstance: { close: $q.resolve(null) },
pipelineTemplateConfig: {
config: {
pipeline: {
name: 'My Managed Pipeline',
template: {
source: 'spinnaker://myPipelineId',
},
},
},
},
pipelineId: '1234',
executionId: null,
isNew: true,
}) as ConfigurePipelineTemplateModalController;
},
示例3: configureApplication
function configureApplication() {
ApplicationDataSourceRegistry.registerDataSource({ key: 'serverGroups' });
application = ApplicationModelBuilder.createApplicationForTests(
'app',
...ApplicationDataSourceRegistry.getDataSources(),
);
application.refresh();
$scope.$digest();
}
示例4: it
it('adds security group names across accounts, falling back to the ID if none found', function () {
let details: ISecurityGroupDetail = null;
const application: Application = applicationModelBuilder.createApplication('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();
});
示例5: it
it('limits executions per pipeline', function () {
const application: Application = modelBuilder.createApplication({key: 'executions', lazy: true}, {key: 'pipelineConfigs', lazy: true});
application.getDataSource('executions').data = [
{ pipelineConfigId: '1', name: 'pipeline 1', endTime: 1, stages: [] },
{ pipelineConfigId: '1', name: 'pipeline 1', endTime: 2, stages: [] },
{ pipelineConfigId: '1', name: 'pipeline 1', endTime: 3, stages: [] },
{ pipelineConfigId: '2', name: 'pipeline 2', endTime: 1, stages: [] },
];
application.getDataSource('pipelineConfigs').data = [
{ name: 'pipeline 1', pipelineConfigId: '1' },
{ name: 'pipeline 2', pipelineConfigId: '2' },
];
model.sortFilter.count = 2;
model.sortFilter.groupBy = 'none';
service.updateExecutionGroups(application);
$timeout.flush();
expect(model.groups.length).toBe(1);
expect(model.groups[0].executions.length).toBe(3);
expect(model.groups[0].executions.filter((ex: IExecution) => ex.pipelineConfigId === '1').length).toBe(2);
expect(model.groups[0].executions.filter((ex: IExecution) => ex.pipelineConfigId === '2').length).toBe(1);
model.sortFilter.groupBy = 'name';
service.updateExecutionGroups(application);
$timeout.flush();
expect(model.groups.length).toBe(2);
expect(model.groups[0].executions.length).toBe(2);
expect(model.groups[1].executions.length).toBe(1);
});
示例6: 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.createApplication('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);
});
示例7: beforeEach
beforeEach(() => {
application = applicationModelBuilder.createApplication(
'app',
{
key: 'optionalSource',
optional: true,
visible: true,
},
{
key: 'invisibleSource',
visible: false,
},
{
key: 'requiredSource',
visible: true,
},
{
key: 'optInSource',
optional: true,
visible: true,
optIn: true,
disabled: true,
},
);
application.attributes = { accounts: ['test'] };
});
示例8:
this.buildApplication = (json: any) => {
const app = applicationModelBuilder.createApplication('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;
};
示例9: beforeEach
beforeEach(() => {
const application: Application = applicationModelBuilder.createApplication(
'app',
ApplicationDataSourceRegistry.getDataSources(),
);
command = {
viewState: {
mode: 'create',
},
application: application.name,
} as IServerGroupCommand;
});