Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operationsClient's removeCompletedOperations doesn't work #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* @license
* Copyright (c) 2011, 2014 IBM Corporation and others.
* Copyright (c) 2011, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
Expand Down Expand Up @@ -120,7 +120,9 @@ define(['i18n!orion/operations/nls/messages', "orion/Deferred"], function(messag
}
}
}
that._preferenceService.put(NAMESPACE, globalOperations).then(def.resolve, def.reject);
// overriding the preference key's value completely so set it to clear
var options = { clear: true };
that._preferenceService.put(NAMESPACE, globalOperations, options).then(def.resolve, def.reject);
});
};
}(def), function(def) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* @license
* Copyright (c) 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
* License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
*
* Contributors: IBM Corporation - initial API and implementation
* Google Inc. - Casey Flynn ([email protected])
******************************************************************************/
/*eslint-env browser, amd, mocha*/
define([
"chai/chai",
"orion/bootstrap",
'orion/serviceregistry',
"orion/operationsClient",
"orion/progress",
"mocha/mocha"
], function(chai, mBootstrap, mServiceRegistry, mOperationsClient, mProgress) {
var assert = chai.assert;

describe("Operations Client", function() {
it("Bug 510646", function(finished) {
mBootstrap.startup().then(function(core) {
var serviceRegistry = core.serviceRegistry;
var operationsClient = new mOperationsClient.OperationsClient(serviceRegistry);
var progressService = new mProgress.ProgressService(serviceRegistry, operationsClient);
var operation = {};
operation.Location = "/task/temp/bug510646";
operation.expires = 0;
operation.Name = "test";
operation.progressMonitor = {};
operation.progressMonitor.progress = function() {};
progressService.writeOperation(0, operation);
return operationsClient.removeCompletedOperations()
.then(function() {
return operationsClient.getOperations();
})
.then(function(operations) {
assert.equal(Object.keys(operations).length, 0);
finished();
});
})
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"js-tests/ui/globalSearch/globalSearchTests",
"js-tests/ui/HTMLTemplates/HTMLTemplateTests",
"js-tests/ui/objects/objectsTests",
"js-tests/ui/operations/operationsClientTests",
"js-tests/ui/pageUtil/pageUtilTests",
"js-tests/ui/searchCrawler/searchCrawlerTests",
"js-tests/ui/settings/settingsTests",
Expand Down