Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit c684faaa authored by calocedre TAC's avatar calocedre TAC
Browse files

move tests in a dedicated folder and use standard maven folders

parent 4ce34082
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>clea-lsp</groupId>
<groupId>fr.inria.clea</groupId>
<artifactId>clea-lsp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
......
/*
* Copyright (C) Inria, 2021
*/
package clea.lsp;
package fr.inria.clea.lsp;
import java.util.UUID;
import fr.devnied.bitlib.BytesUtils;
......
/*
* Copyright (C) Inria, 2021
*/
package clea.lsp;
package fr.inria.clea.lsp;
import java.util.Arrays;
import java.util.Base64;
......
/*
* Copyright (C) Inria, 2021
*/
package clea.lsp;
package fr.inria.clea.lsp;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
......
/*
* Copyright (C) Inria, 2021
*/
package clea.lsp;
package fr.inria.clea.lsp;
import java.util.Calendar;
import java.util.Base64;
......
package fr.inria.clea.lsp;
public class LspEncoderDecoder {
/**
* Main
*
* @see README.md
*
*/
public static void main(String[] args) throws Exception {
final String help = "Usage: LspEncoderDecoder [decode lsp64 privKey] [encode staff countryCode CRIexp venueType venueCategory1 venueCategory2 periodDuration locationPhone locationPin pubkey]";
LocationSpecificPartTest tests = new LocationSpecificPartTest();
if (args.length == 0) {
tests.test2(false);
} else if ("encode".equals(args[0])) {
if ((args.length == 13) || (args.length == 11)) {
int staff = Integer.parseInt(args[1]);
int countryCode = Integer.parseInt(args[2]);
int CRIexp = Integer.parseInt(args[3]);
int venueType = Integer.parseInt(args[4]);
int venueCategory1 = Integer.parseInt(args[5]);
int venueCategory2 = Integer.parseInt(args[6]);
int periodDuration = Integer.parseInt(args[7]);
final String PK_SA = args[8];
final String PK_MCTA = args[9];
final String SK_L = args[10];
Encode lsp = new Encode(SK_L, PK_SA, PK_MCTA, false);
if (args.length == 13) {
final String locationPhone = args[11];
final String locationPin = args[12];
lsp.setParam(staff, countryCode, CRIexp, venueType, venueCategory1, venueCategory2, periodDuration,
locationPhone, locationPin);
} else {
lsp.setParam(staff, countryCode, CRIexp, venueType, venueCategory1, venueCategory2, periodDuration);
}
lsp.startNewPeriod();
final String valuesToreturn = lsp.getLSPTobase64() + " " + lsp.LTId + " "
+ Integer.toUnsignedString(lsp.ct_periodStart) + " " + Integer.toUnsignedString(lsp.t_qrStart);
System.out.println(valuesToreturn);
} else {
System.out.println(help);
}
} else if ("decode".equals(args[0])) {
if (args.length == 4) {
String lsp64 = args[1];
String SK_SA = args[2];
String SK_MCTA = args[3];
Decode lsp = new Decode(SK_SA, SK_MCTA, false);
lsp.getLSP(lsp64);
System.out.print(lsp.staff + " " + lsp.countryCode + " " + lsp.CRIexp + " " + lsp.venueType + " "
+ lsp.venueCategory1 + " " + lsp.venueCategory2 + " " + lsp.periodDuration + " " + lsp.LTId
+ " " + Integer.toUnsignedString(lsp.ct_periodStart) + " "
+ Integer.toUnsignedString(lsp.t_qrStart));
if (lsp.locContactMsgPresent == 1) {
System.out.print(" " + lsp.locationPhone + " " + lsp.locationPIN);
}
System.out.println();
} else {
System.out.println(help);
}
} else {
System.out.println(help);
}
}
}
/*
* Copyright (C) Inria, 2021
*/
package clea.lsp;
package fr.inria.clea.lsp;
import java.io.File;
import java.io.FileOutputStream;
......@@ -21,11 +21,8 @@ import fr.devnied.bitlib.BytesUtils;
* Some locationSpecificPart (LSP) CLEA tests
*
* @see <a href="https://hal.inria.fr/hal-03146022">CLEA protocol</a>
*
*
*
*/
class Test {
class LocationSpecificPartTest {
/* Exemple of a SK_L used for the tests */
final String SK_L = "23c9b8f36ac1c0cddaf869c3733b771c3dc409416a9695df40397cea53e7f39e21f76925fc0c74ca6ee7c7eafad92473fd85758bab8f45fe01aac504";
......@@ -246,67 +243,4 @@ class Test {
System.out.println("PLAIN LSP: " + BytesUtils.bytesToString(msg));
}
/**
* Main
*
* @see README.md
*
*/
public static void main(String[] args) throws Exception {
final String help = "Usage: Test [decode lsp64 privKey] [encode staff countryCode CRIexp venueType venueCategory1 venueCategory2 periodDuration locationPhone locationPin pubkey]";
Test tests = new Test();
if (args.length == 0) {
tests.test2(false);
} else if ("encode".equals(args[0])) {
if ((args.length == 13) || (args.length == 11)) {
int staff = Integer.parseInt(args[1]);
int countryCode = Integer.parseInt(args[2]);
int CRIexp = Integer.parseInt(args[3]);
int venueType = Integer.parseInt(args[4]);
int venueCategory1 = Integer.parseInt(args[5]);
int venueCategory2 = Integer.parseInt(args[6]);
int periodDuration = Integer.parseInt(args[7]);
final String PK_SA = args[8];
final String PK_MCTA = args[9];
final String SK_L = args[10];
Encode lsp = new Encode(SK_L, PK_SA, PK_MCTA, false);
if (args.length == 13) {
final String locationPhone = args[11];
final String locationPin = args[12];
lsp.setParam(staff, countryCode, CRIexp, venueType, venueCategory1, venueCategory2, periodDuration,
locationPhone, locationPin);
} else {
lsp.setParam(staff, countryCode, CRIexp, venueType, venueCategory1, venueCategory2, periodDuration);
}
lsp.startNewPeriod();
final String valuesToreturn = lsp.getLSPTobase64() + " " + lsp.LTId + " "
+ Integer.toUnsignedString(lsp.ct_periodStart) + " " + Integer.toUnsignedString(lsp.t_qrStart);
System.out.println(valuesToreturn);
} else {
System.out.println(help);
}
} else if ("decode".equals(args[0])) {
if (args.length == 4) {
String lsp64 = args[1];
String SK_SA = args[2];
String SK_MCTA = args[3];
Decode lsp = new Decode(SK_SA, SK_MCTA, false);
lsp.getLSP(lsp64);
System.out.print(lsp.staff + " " + lsp.countryCode + " " + lsp.CRIexp + " " + lsp.venueType + " "
+ lsp.venueCategory1 + " " + lsp.venueCategory2 + " " + lsp.periodDuration + " " + lsp.LTId
+ " " + Integer.toUnsignedString(lsp.ct_periodStart) + " "
+ Integer.toUnsignedString(lsp.t_qrStart));
if (lsp.locContactMsgPresent == 1) {
System.out.print(" " + lsp.locationPhone + " " + lsp.locationPIN);
}
System.out.println();
} else {
System.out.println(help);
}
} else {
System.out.println(help);
}
}
}
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