Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
update tests dependencies and stabilize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amiramw committed Dec 10, 2017
1 parent 02f0560 commit eeddb9d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/sap/lsp/cf/ws/WSSynchronization.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private void syncWorkspace(InputStream workspaceZipStream, File destination) thr
// Create sync label file
long timestamp = System.currentTimeMillis();
File syncFile = new File(destination, SYNC_FILE);
new FileOutputStream(syncFile).close();
syncFile.createNewFile();
syncFile.setLastModified(timestamp);
}

Expand Down Expand Up @@ -383,8 +383,8 @@ private void handleLSPDest(boolean bReg, BufferedReader reader) {

private boolean checkSync() {
String workspaceSaveDir = this.saveDir;
File fSyncts = new File(new File(workspaceSaveDir),SYNC_FILE);
return fSyncts.exists();
File fSync = new File(new File(workspaceSaveDir), SYNC_FILE);
return fSync.exists();
}


Expand Down
10 changes: 5 additions & 5 deletions src/test/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"test": "mocha --timeout 20000"
},
"devDependencies": {
"chai": "4.1.1",
"mocha": "3.5.0",
"chai": "4.1.2",
"mocha": "4.0.1",
"promise": "8.0.1",
"sleep": "5.1.1",
"promise-timeout": "1.1.1",
"request": "2.81.0",
"request-promise": "4.2.1",
"ws": "3.1.0"
"request": "2.83.0",
"request-promise": "4.2.2",
"ws": "3.3.2"
},
"dependencies": {
"assert": "1.4.1"
Expand Down
4 changes: 2 additions & 2 deletions src/test/javascript/test/SyncIntegrationFullTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ describe('Sync Integration Full loop Test', function () {
new Promise(function (resolve, reject) {
aSubscribers.push({
method: "workspace/didChangeWatchedFiles", callback: function (oLspMsg) {
console.log("Test response delete single file - loopback received:\n" + JSON.stringify(oLspMsg));
expect(oLspMsg, "Delete notification faillure").to.deep.equal(delete1Resp);
console.log("Test response delete single file - loop back received:\n" + JSON.stringify(oLspMsg));
expect(oLspMsg, "Delete notification failure").to.deep.equal(delete1Resp);
resolve();
}
})
Expand Down
20 changes: 11 additions & 9 deletions src/test/javascript/test/SyncNoWebsocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ describe('Sync Integration Test - no websocket', function () {
form.append('file', fs.createReadStream(zipFilePath));
}).then(function () {
// putting file that already exists should fail
return new Promise(function (resolve) {
let req = request.put(pathPrefix + modulePath + '/java/test.java', COMMON_OPTIONS, function (err, res) {
console.log("error: " + err);
console.log("res: " + res);
assert.ok(res);
assert.equal(res.statusCode, 403);
resolve(res);
setTimeout(function () {
return new Promise(function (resolve) {
let req = request.put(pathPrefix + modulePath + '/java/test.java', COMMON_OPTIONS, function (err, res) {
console.log("error: " + err);
console.log("res: " + res);
assert.ok(res);
assert.equal(res.statusCode, 403);
resolve(res);
});
req.form().append('file', fs.createReadStream(zipFilePath));
});
req.form().append('file', fs.createReadStream(zipFilePath));
});
}, 10);
}).then(deletePath.bind(undefined, '/java/test.java', filePath));
});

Expand Down
12 changes: 6 additions & 6 deletions src/test/javascript/test/util/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const fs = require('fs');

module.exports = {

deleteFolderRecursive: function (path) {
var that = this;
deleteFolderRecursive: function (path) {
let that = this;
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function(file,index){
var curPath = path + "/" + file;
fs.readdirSync(path).forEach(function (file, index) {
let curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { // recurse
that.deleteFolderRecursive(curPath);
that.deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
Expand All @@ -17,4 +17,4 @@ module.exports = {
}
}

}
};

0 comments on commit eeddb9d

Please sign in to comment.