Commit 7e9f3378 authored by Kumquat Orange's avatar Kumquat Orange Committed by calocedre TAC
Browse files

gestion decode java

parent e0b4af07
...@@ -55,6 +55,7 @@ testjs: ...@@ -55,6 +55,7 @@ testjs:
- cd CLEA-lib/js - cd CLEA-lib/js
- pwd || true - pwd || true
- cp ../java/target/clea-crypto-0.0.1-SNAPSHOT-jar-with-dependencies.jar ./clea-crypto.jar - cp ../java/target/clea-crypto-0.0.1-SNAPSHOT-jar-with-dependencies.jar ./clea-crypto.jar
- java -cp ./clea-crypto.jar fr.inria.clea.lsp.LspEncoderDecoder decode || true
- export CHROME_BIN=chromium - export CHROME_BIN=chromium
- export FIREFOX_BIN=firefox-esr - export FIREFOX_BIN=firefox-esr
- npm install - npm install
......
...@@ -10,6 +10,7 @@ csv({noheader: true, ...@@ -10,6 +10,7 @@ csv({noheader: true,
cryptoList = jsonObj; cryptoList = jsonObj;
}) })
setTimeout(function() { setTimeout(function() {
describe('test suite for crypto', function () { describe('test suite for crypto', function () {
...@@ -18,25 +19,26 @@ setTimeout(function() { ...@@ -18,25 +19,26 @@ setTimeout(function() {
it('test on [' + cryptoItem.browser + '] with ' + cryptoItem.staff + ' ' + cryptoItem.CRIexp + ' ' + cryptoItem.venueType + ' ' + cryptoItem.venueCategory1 it('test on [' + cryptoItem.browser + '] with ' + cryptoItem.staff + ' ' + cryptoItem.CRIexp + ' ' + cryptoItem.venueType + ' ' + cryptoItem.venueCategory1
+ ' ' + cryptoItem.venueCategory2 + ' ' + cryptoItem.countryCode + ' ' + cryptoItem.periodDuration , async () => { + ' ' + cryptoItem.venueCategory2 + ' ' + cryptoItem.countryCode + ' ' + cryptoItem.periodDuration , async () => {
await new Promise((resolve) => { await new Promise((resolve) => {
let result; let result = '';
console.log(process.cwd());
const javaproc = spawn('java', ['-cp', let javadir = process.cwd();
'./clea-crypto.jar ', console.log(javadir);
const javaproc = spawn('java', ['-cp', javadir+'/clea-crypto.jar',
'fr.inria.clea.lsp.LspEncoderDecoder', 'decode', 'fr.inria.clea.lsp.LspEncoderDecoder', 'decode',
cryptoItem.result, cryptoItem.result,
cryptoItem.sk_l, cryptoItem.sk_l,
cryptoItem.pk_sa], cryptoItem.pk_sa]);
{cwd: process.cwd()});
javaproc.stdout.on('data', (data) => { javaproc.stdout.on('data', (data) => {
console.log(data.toString()); console.log(data.toString());
result = data.toString().trim().split(' '); let str = data.toString().replace(/(\r\n|\n|\r)/gm, "").trim();
//assert.isTrue(true); if (str && str.length > 0 ) {
result = str.split(' ');
}
}); });
javaproc.stderr.on('data', (data) => { javaproc.stderr.on('data', (data) => {
console.error(data.toString()); console.error(data.toString());
//assert.isTrue(false);
}); });
javaproc.on('exit', (code) => { javaproc.on('exit', (code) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment