mirror of
https://github.com/nasa/openmct.git
synced 2025-05-03 17:22:56 +00:00
Merge branch 'topic-conditionals' of https://github.com/nasa/openmct into condition-class
This commit is contained in:
commit
8ca202d0a9
@ -24,15 +24,15 @@ import * as EventEmitter from 'eventemitter3';
|
|||||||
|
|
||||||
export default class TelemetryCriterion extends EventEmitter {
|
export default class TelemetryCriterion extends EventEmitter {
|
||||||
|
|
||||||
constructor(telemetryDomainObject, openmct) {
|
constructor(telemetryDomainObjectKey, openmct) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.telemetryObject = telemetryDomainObject;
|
|
||||||
this.openmct = openmct;
|
this.openmct = openmct;
|
||||||
|
this.telemetryObject = this.openmct.objects.get(this.openmct.objects.makeKeyString(telemetryDomainObjectKey));
|
||||||
this.telemetryAPI = this.openmct.telemetry;
|
this.telemetryAPI = this.openmct.telemetry;
|
||||||
this.subscription = null;
|
this.subscription = null;
|
||||||
this.telemetryObjectIdAsString = null;
|
|
||||||
this.telemetryMetadata = null;
|
this.telemetryMetadata = null;
|
||||||
|
this.telemetryObjectIdAsString = null;
|
||||||
if (this.telemetryAPI.isTelemetryObject(this.telemetryObject)) {
|
if (this.telemetryAPI.isTelemetryObject(this.telemetryObject)) {
|
||||||
this.telemetryObjectIdAsString = this.openmct.objects.makeKeyString(this.telemetryObject.identifier);
|
this.telemetryObjectIdAsString = this.openmct.objects.makeKeyString(this.telemetryObject.identifier);
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ export default class TelemetryCriterion extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emitResult(data, error) {
|
emitResult(data, error) {
|
||||||
this.emit('criterion::Update', {
|
this.emit('criterionUpdated', {
|
||||||
identifier: this.telemetryObjectIdAsString,
|
identifier: this.telemetryObjectIdAsString,
|
||||||
data: data,
|
data: data,
|
||||||
error: error
|
error: error
|
||||||
|
@ -21,9 +21,8 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
import TelemetryCriterion from "./TelemetryCriterion";
|
import TelemetryCriterion from "./TelemetryCriterion";
|
||||||
import { createOpenMct } from "../../../testTools";
|
|
||||||
|
|
||||||
let openmct,
|
let openmct = {},
|
||||||
mockListener,
|
mockListener,
|
||||||
testTelemetryObject,
|
testTelemetryObject,
|
||||||
telemetryCriterion;
|
telemetryCriterion;
|
||||||
@ -31,8 +30,6 @@ let openmct,
|
|||||||
describe("The telemetry criterion", function () {
|
describe("The telemetry criterion", function () {
|
||||||
|
|
||||||
beforeEach (() => {
|
beforeEach (() => {
|
||||||
openmct = createOpenMct();
|
|
||||||
mockListener = jasmine.createSpy('listener');
|
|
||||||
testTelemetryObject = {
|
testTelemetryObject = {
|
||||||
identifier:{ namespace: "", key: "test-object"},
|
identifier:{ namespace: "", key: "test-object"},
|
||||||
type: "test-object",
|
type: "test-object",
|
||||||
@ -53,13 +50,21 @@ describe("The telemetry criterion", function () {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
||||||
|
openmct.objects.get.and.returnValue(testTelemetryObject);
|
||||||
|
openmct.objects.makeKeyString.and.returnValue(testTelemetryObject.identifier.key);
|
||||||
|
openmct.telemetry = jasmine.createSpyObj('telemetry', ['isTelemetryObject', "subscribe"]);
|
||||||
|
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
||||||
|
openmct.telemetry.subscribe.and.returnValue(function () {});
|
||||||
|
|
||||||
|
mockListener = jasmine.createSpy('listener');
|
||||||
|
|
||||||
telemetryCriterion = new TelemetryCriterion(
|
telemetryCriterion = new TelemetryCriterion(
|
||||||
testTelemetryObject,
|
testTelemetryObject.identifier,
|
||||||
openmct
|
openmct
|
||||||
);
|
);
|
||||||
|
|
||||||
telemetryCriterion.on('criterion::Update', mockListener);
|
telemetryCriterion.on('criterionUpdated', mockListener);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user