fix(types): Add StringMap type
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
import { Date } from 'angular2/src/facade/lang';
|
||||
import { StringMap } from 'angular2/src/facade/collection';
|
||||
|
||||
export class MeasureValues {
|
||||
timeStamp:Date;
|
||||
runIndex:number;
|
||||
values:any;
|
||||
values:StringMap;
|
||||
|
||||
constructor(runIndex:number, timeStamp:Date, values:any) {
|
||||
constructor(runIndex:number, timeStamp:Date, values:StringMap) {
|
||||
this.timeStamp = timeStamp;
|
||||
this.runIndex = runIndex;
|
||||
this.values = values;
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
import {
|
||||
ABSTRACT, BaseException
|
||||
} from 'angular2/src/facade/lang';
|
||||
import { StringMap } from 'angular2/src/facade/collection';
|
||||
|
||||
/**
|
||||
* A metric is measures values
|
||||
@ -22,7 +23,7 @@ export class Metric {
|
||||
* since the begin call.
|
||||
* @param restart: Whether to restart right after this.
|
||||
*/
|
||||
endMeasure(restart:boolean):Promise<any> {
|
||||
endMeasure(restart:boolean):Promise<StringMap> {
|
||||
throw new BaseException('NYI');
|
||||
}
|
||||
|
||||
@ -30,7 +31,7 @@ export class Metric {
|
||||
* Describes the metrics provided by this metric implementation.
|
||||
* (e.g. units, ...)
|
||||
*/
|
||||
describe():any {
|
||||
describe():StringMap {
|
||||
throw new BaseException('NYI');
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PromiseWrapper, Promise } from 'angular2/src/facade/async';
|
||||
import { isPresent, isBlank, int, BaseException, StringWrapper } from 'angular2/src/facade/lang';
|
||||
import { ListWrapper } from 'angular2/src/facade/collection';
|
||||
import { ListWrapper, StringMap } from 'angular2/src/facade/collection';
|
||||
import { bind, OpaqueToken } from 'angular2/di';
|
||||
|
||||
import { WebDriverExtension } from '../web_driver_extension';
|
||||
@ -28,7 +28,7 @@ export class PerflogMetric extends Metric {
|
||||
this._setTimeout = setTimeout;
|
||||
}
|
||||
|
||||
describe() {
|
||||
describe():StringMap {
|
||||
return {
|
||||
'script': 'script execution time in ms',
|
||||
'render': 'render time in ms',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StringMapWrapper, ListWrapper } from 'angular2/src/facade/collection';
|
||||
import { StringMapWrapper, ListWrapper, StringMap } from 'angular2/src/facade/collection';
|
||||
import { bind, OpaqueToken } from 'angular2/di';
|
||||
import { Sampler } from './sampler';
|
||||
import { Validator } from './validator';
|
||||
@ -13,10 +13,10 @@ export class SampleDescription {
|
||||
static get BINDINGS() { return _BINDINGS; }
|
||||
|
||||
id:string;
|
||||
description:any;
|
||||
metrics:any;
|
||||
description:StringMap;
|
||||
metrics:StringMap;
|
||||
|
||||
constructor(id, descriptions, metrics) {
|
||||
constructor(id, descriptions:List<StringMap>, metrics:StringMap) {
|
||||
this.id = id;
|
||||
this.metrics = metrics;
|
||||
this.description = {};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { isPresent, isBlank, Date, DateWrapper } from 'angular2/src/facade/lang';
|
||||
import { Promise, PromiseWrapper } from 'angular2/src/facade/async';
|
||||
import { StringMapWrapper, List, ListWrapper } from 'angular2/src/facade/collection';
|
||||
import { StringMapWrapper, StringMap, List, ListWrapper } from 'angular2/src/facade/collection';
|
||||
import { bind, OpaqueToken } from 'angular2/di';
|
||||
|
||||
import { Metric } from './metric';
|
||||
@ -95,7 +95,7 @@ export class Sampler {
|
||||
.then( (measureValues) => this._report(lastState, measureValues) );
|
||||
}
|
||||
|
||||
_report(state:SampleState, metricValues:any):Promise<SampleState> {
|
||||
_report(state:SampleState, metricValues:StringMap):Promise<SampleState> {
|
||||
var measureValues = new MeasureValues(state.completeSample.length, this._time(), metricValues);
|
||||
var completeSample = ListWrapper.concat(state.completeSample, [measureValues]);
|
||||
var validSample = this._validator.validate(completeSample);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { List } from 'angular2/src/facade/collection';
|
||||
import { List, StringMap } from 'angular2/src/facade/collection';
|
||||
import {
|
||||
ABSTRACT, BaseException
|
||||
} from 'angular2/src/facade/lang';
|
||||
@ -23,7 +23,7 @@ export class Validator {
|
||||
* Returns a Map that describes the properties of the validator
|
||||
* (e.g. sample size, ...)
|
||||
*/
|
||||
describe():any {
|
||||
describe():StringMap {
|
||||
throw new BaseException('NYI');
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { List, ListWrapper } from 'angular2/src/facade/collection';
|
||||
import { List, ListWrapper, StringMap } from 'angular2/src/facade/collection';
|
||||
import { bind, OpaqueToken } from 'angular2/di';
|
||||
|
||||
import { Validator } from '../validator';
|
||||
@ -26,7 +26,7 @@ export class RegressionSlopeValidator extends Validator {
|
||||
this._metric = metric;
|
||||
}
|
||||
|
||||
describe():any {
|
||||
describe():StringMap {
|
||||
return {
|
||||
'sampleSize': this._sampleSize,
|
||||
'regressionSlopeMetric': this._metric
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { List, ListWrapper } from 'angular2/src/facade/collection';
|
||||
import { List, ListWrapper, StringMap } from 'angular2/src/facade/collection';
|
||||
import { bind, OpaqueToken } from 'angular2/di';
|
||||
|
||||
import { Validator } from '../validator';
|
||||
import { MeasureValues } from '../measure_values';
|
||||
|
||||
/**
|
||||
* A validator that waits for the sample to have a certain size.
|
||||
@ -19,13 +20,13 @@ export class SizeValidator extends Validator {
|
||||
this._sampleSize = size;
|
||||
}
|
||||
|
||||
describe():any {
|
||||
describe():StringMap {
|
||||
return {
|
||||
'sampleSize': this._sampleSize
|
||||
};
|
||||
}
|
||||
|
||||
validate(completeSample:List<any>):List<any> {
|
||||
validate(completeSample:List<MeasureValues>):List<MeasureValues> {
|
||||
if (completeSample.length >= this._sampleSize) {
|
||||
return ListWrapper.slice(completeSample, completeSample.length - this._sampleSize, completeSample.length);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user