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

Rendu labo David Jaquet et Vincent Guidoux #88

Open
wants to merge 102 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
5de7a9d
Adding 4 new tests for V2 protocol
Mar 25, 2018
32056c0
adding Tests for Protocol V2
yosra-harbaoui Mar 27, 2018
7c77d5a
Task 3 implemented, all tests passed
onicoleheig Mar 27, 2018
19d87e4
Test ProtocolV2 - SmithHeig
SmithHeig Mar 28, 2018
3d19ef0
add LionelNanchen V2 test
Mar 28, 2018
34bb3bd
Implementation of RouletteV1ClientImpl
christophe-joyet Mar 28, 2018
384a77e
adding test for protocol v2
Mar 31, 2018
83a84a9
Test for the Roulette protocol V2
mlabie Apr 1, 2018
cce4424
tests V2 impl added
onicoleheig Apr 3, 2018
d33ee1c
Added V2 tests
Angorance Apr 3, 2018
3da4065
adding tests
yannled Apr 3, 2018
2365dd4
implementation of Tests for the Roulette v2
LaghaOussama Apr 3, 2018
495c9ce
Adding some new tests
rlabinot Apr 3, 2018
5047a88
Adding tests for V2 protocol - Rochat Antoine & Schopfer Benoit
ouzgaga Apr 3, 2018
29436d1
2 tests added
romaingallay Apr 3, 2018
ade1984
Merge branch 'fb-lab02-v2-contrib' into fb-lab02-v2-tests
ouzgaga Apr 3, 2018
facb236
RouletteV2dorianekaffoTest
Apr 3, 2018
a2d1a9a
Rendu test personnalisé
shinopill Apr 3, 2018
68ddd3d
Adding tests for V2 protocol
ouzgaga Apr 3, 2018
b59aece
Merge branch 'fb-lab02-v2-contrib' into fb-lab02-v2-tests
ouzgaga Apr 3, 2018
c5f66ac
add test for v2
AdamZouari Apr 3, 2018
b06a7dd
Add tests methods name. Will be implemented
Apr 3, 2018
a523cf2
A few tests implemented
Schnoudli Apr 3, 2018
cc60bc3
A few tests are implemented
Schnoudli Apr 3, 2018
2d9bb13
add my own test for V2 protocol
Mantha32 Apr 3, 2018
66a7148
add V2 tests
ovesco Apr 4, 2018
7c46d65
Merge pull request #1 from romainSilvestri/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
033701a
Merge pull request #3 from SmithHeig/fb-lab02-v2-tests
wasadigi Apr 4, 2018
a34835a
Merge pull request #4 from LionelNanchen/fb-lab02-v2-tests
wasadigi Apr 4, 2018
bb59dfc
Merge pull request #6 from olivierKopp/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
36b4461
Merge pull request #15 from Angorance/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
1bad178
Merge pull request #16 from yannled/test
wasadigi Apr 4, 2018
79b1ae0
Merge pull request #18 from rlabinot/fb-lab02-v2-tests
wasadigi Apr 4, 2018
1b74230
Merge pull request #19 from ouzgaga/fb-lab02-v2-tests
wasadigi Apr 4, 2018
379a55e
Merge pull request #21 from shinopill/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
51ed056
Merge pull request #23 from AdamZouari/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
498a94a
Merge pull request #24 from Mantha32/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
6db3601
Merge pull request #27 from sysmoh/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
07bd65a
Merge pull request #28 from tranqui793/fb-lab02-v2-contrib
wasadigi Apr 4, 2018
09f400e
implement of tests v2
christophe-joyet Apr 4, 2018
34b46fa
rm change from clientImpl
christophe-joyet Apr 4, 2018
e12cf50
rm change from impl file
christophe-joyet Apr 4, 2018
12d3d6a
rm change from file implClient
christophe-joyet Apr 4, 2018
de89e9e
...
christophe-joyet Apr 4, 2018
0f969e2
...
christophe-joyet Apr 4, 2018
c0f82dc
version_1_2
fabano237 Apr 4, 2018
de09a7a
First batch of student tests for v2; cleaned up; pass reference imple…
wasadigi Apr 4, 2018
173b1cc
6 Tests for the V2 Protocol added by Frueh and Muaremi
Ludwig9392 Apr 4, 2018
f7693e4
Test RouletteV2 Bryan Curchod/François Burgener
francoisburgener Apr 4, 2018
78d80a6
Récupération des testes
francoisburgener Apr 4, 2018
51da0f1
test v2
GZeed Apr 4, 2018
1e3c016
automated tests to specify the behaviour of the v2 protocol
Dumoria Apr 4, 2018
3770534
tests implemented
SachaKor Apr 4, 2018
966651b
resotre files...
onicoleheig Apr 4, 2018
70d6d2d
ajout tests pour RouletteV2Protocol
Apr 4, 2018
aac4560
restore files.. again
onicoleheig Apr 4, 2018
089d287
V2 tests Schurch Kaufmann
Jokau Apr 4, 2018
551ddbb
Added tests Roulette v2 github id: nfluckiger and manalito
manalito Apr 4, 2018
7f2f5e2
update tests Roulette v2 github id: nfluckiger and manalito
manalito Apr 4, 2018
b459c9e
Protocol V2 Tests - Adrien Allemand, Loyse Krug
Grogath Apr 4, 2018
fb9a49f
enfin ?
Nortalle Apr 4, 2018
a231229
With correct file staged ^^'
Grogath Apr 4, 2018
3cb7c92
Merge branch 'fb-lab02-v2-tests' of https://github.com/Nortalle/Teach…
Nortalle Apr 4, 2018
ac2bbb3
Some more tests
Schnoudli Apr 4, 2018
79f7c0d
tests implemented
SachaKor Apr 4, 2018
d329bc6
Remove hardcoded port for V2 and useless unimplemented tests
Apr 4, 2018
51c8b67
Correct mistake
Apr 4, 2018
c835f57
test v2
GZeed Apr 4, 2018
68662b2
Merge branch 'fb-labo02-v2-newcontrib' of https://github.com/GZeed/Te…
GZeed Apr 4, 2018
4f3d4a1
delete properties
GZeed Apr 4, 2018
9a0ae0d
Final commit
Apr 4, 2018
e2dadaf
tests v2 submitted
maxcaduff Apr 4, 2018
0b66499
Merge pull request #20 from dorianekaffo/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
9314ca7
Merge pull request #22 from francoisburgener/fb-lab02-v2-tests
wasadigi Apr 5, 2018
b44e6e2
Merge pull request #29 from christophe-joyet/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
18edde8
Merge pull request #30 from ericafabrice/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
42c9b5f
Merge pull request #31 from Ludwig9392/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
baaf06b
Merge pull request #32 from GZeed/fb-labo02-v2-newcontrib
wasadigi Apr 5, 2018
4b7016e
Merge pull request #33 from yosra-harbaoui/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
baec97b
Merge pull request #35 from Dumoria/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
2618c99
Merge pull request #40 from Jokau/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
db5891e
Merge pull request #41 from mathieujee/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
8350c1b
Merge pull request #42 from LoyseKrug/fb-lab02-v2-tests
wasadigi Apr 5, 2018
aae8eee
Merge pull request #43 from manalito/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
58754f9
Merge pull request #44 from Nortalle/fb-lab02-v2-tests
wasadigi Apr 5, 2018
5077abb
Merge pull request #10 from onicoleheig/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
6a10e91
Merge pull request #46 from mlabie/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
790c9a0
Merge pull request #47 from amadeous/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
8632d11
Merge pull request #49 from SachaKor/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
b953a22
Merge pull request #51 from p-stackouse/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
f48b078
Merge pull request #53 from maxcaduff/fb-lab02-v2-contrib
wasadigi Apr 5, 2018
660181f
Add second batch of curated student contributions; reference impl pas…
wasadigi Apr 5, 2018
5d8d0ad
voila
Nortalle Apr 8, 2018
b16bbff
oui
Nortalle Apr 8, 2018
0fd2862
premiere implementation
Nortalle Apr 8, 2018
16d7de6
Enlever des attentes de reponses de serveurs en trop
djaquet5 Apr 8, 2018
94a3d1d
Correction de bug, remise de l'attente de réponse du serveur dans la V1
djaquet5 Apr 8, 2018
18e629d
Correction de bugs
djaquet5 Apr 8, 2018
1e078a1
presque
Nortalle Apr 8, 2018
bfbaa6e
presque
Nortalle Apr 8, 2018
588692b
presque
Nortalle Apr 8, 2018
52e9835
ou
Nortalle Apr 8, 2018
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
15 changes: 1 addition & 14 deletions QuizRouletteServer-build/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,348 changes: 809 additions & 539 deletions QuizRouletteServer-build/.idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion QuizRouletteServer-build/QuizRouletteServer-build.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ public interface IRouletteV2Client extends IRouletteV1Client {
*/
public List<Student> listStudents() throws IOException;

public int getNumberOfCommands() throws IOException;

public int getNumberOfStudentAdded() throws IOException;

public boolean checkSuccessOfCommand() throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import ch.heigvd.res.labs.roulette.data.EmptyStoreException;
import ch.heigvd.res.labs.roulette.data.JsonObjectMapper;
import ch.heigvd.res.labs.roulette.net.protocol.RouletteV1Protocol;
import ch.heigvd.res.labs.roulette.data.Student;
import ch.heigvd.res.labs.roulette.net.protocol.InfoCommandResponse;
import ch.heigvd.res.labs.roulette.net.protocol.RandomCommandResponse;
import ch.heigvd.res.labs.roulette.net.protocol.RouletteV1Protocol;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Expand All @@ -18,53 +19,143 @@

/**
* This class implements the client side of the protocol specification (version 1).
*
*
* @author Olivier Liechti
* @author Vincent Guidoux
* @author David Jaquet
*/
public class RouletteV1ClientImpl implements IRouletteV1Client {

private static final Logger LOG = Logger.getLogger(RouletteV1ClientImpl.class.getName());
private static final Logger LOG = Logger.getLogger(RouletteV1ClientImpl.class.getName());

protected Socket socket = null;
protected BufferedReader reader = null;
protected PrintWriter writer = null;

protected int nbCommands = 0;

@Override
public void connect(String server, int port) throws IOException {
LOG.log(Level.INFO, "Attempting to connect...");

socket = new Socket(server, port);
reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true);

if (isConnected())
reader.readLine();

LOG.log(Level.INFO, "Connected");
}

@Override
public void disconnect() throws IOException {
LOG.log(Level.INFO, "Attempting to disconnect...");
closeConnection();
LOG.log(Level.INFO, "Disconnected");
nbCommands++;
}

@Override
public boolean isConnected() {
return socket != null && socket.isConnected();
}

@Override
public void loadStudent(String fullname) throws IOException {
LOG.log(Level.INFO, "Loading student " + fullname);

writeInWriter(RouletteV1Protocol.CMD_LOAD);

reader.readLine();

writeInWriter(fullname);
writeInWriter(RouletteV1Protocol.CMD_LOAD_ENDOFDATA_MARKER);
reader.readLine();

nbCommands++;
}

@Override
public void loadStudents(List<Student> students) throws IOException {
LOG.log(Level.INFO, "Loading a list of students");

writeInWriter(RouletteV1Protocol.CMD_LOAD);

reader.readLine();

for (Student student : students)
writeInWriter(student.getFullname());

writeInWriter(RouletteV1Protocol.CMD_LOAD_ENDOFDATA_MARKER);

reader.readLine();

nbCommands++;
}

@Override
public Student pickRandomStudent() throws EmptyStoreException, IOException {
LOG.log(Level.INFO, "Pick a random student");

writeInWriter(RouletteV1Protocol.CMD_RANDOM);

nbCommands++;

RandomCommandResponse response = JsonObjectMapper.parseJson(reader.readLine(), RandomCommandResponse.class);

// There is no student stored
if (response.getError() != null)
throw new EmptyStoreException();

// Cannot make work Student.fromJson()... :(
return new Student(response.getFullname());
}

@Override
public int getNumberOfStudents() throws IOException {
LOG.log(Level.INFO, "Counting the number of students...");

writeInWriter(RouletteV1Protocol.CMD_INFO);

InfoCommandResponse response = JsonObjectMapper.parseJson(reader.readLine(), InfoCommandResponse.class);

nbCommands++;

return response.getNumberOfStudents();
}

@Override
public void connect(String server, int port) throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getProtocolVersion() throws IOException {
LOG.log(Level.INFO, "Getting the protocol version...");

@Override
public void disconnect() throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
writeInWriter(RouletteV1Protocol.CMD_INFO);

@Override
public boolean isConnected() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
InfoCommandResponse response = JsonObjectMapper.parseJson(reader.readLine(), InfoCommandResponse.class);

@Override
public void loadStudent(String fullname) throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
nbCommands++;

@Override
public void loadStudents(List<Student> students) throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
return response.getProtocolVersion();
}

@Override
public Student pickRandomStudent() throws EmptyStoreException, IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public int getNumberOfCommands() throws IOException {
return nbCommands;
}

@Override
public int getNumberOfStudents() throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void closeConnection() throws IOException {
if (writer != null)
writer.close();

@Override
public String getProtocolVersion() throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
if (reader != null)
reader.close();


if (socket != null)
socket.close();
}

}
protected void writeInWriter(String value) {
writer.println(value);
writer.flush();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,102 @@
import ch.heigvd.res.labs.roulette.data.JsonObjectMapper;
import ch.heigvd.res.labs.roulette.data.Student;
import ch.heigvd.res.labs.roulette.data.StudentsList;
import ch.heigvd.res.labs.roulette.net.protocol.ListStudentCommandResponse;
import ch.heigvd.res.labs.roulette.net.protocol.LoadCommandResponse;
import ch.heigvd.res.labs.roulette.net.protocol.RouletteV2Protocol;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* This class implements the client side of the protocol specification (version 2).
*
* @author Olivier Liechti
*/
public class RouletteV2ClientImpl extends RouletteV1ClientImpl implements IRouletteV2Client {
private static final Logger LOG = Logger.getLogger(RouletteV2ClientImpl.class.getName());

private boolean statusLastCommand = false;
private int nbNewStudents = 0;

@Override
public void clearDataStore() throws IOException {
LOG.log(Level.INFO, "Clearing the data store...");

writeInWriter(RouletteV2Protocol.CMD_CLEAR);
reader.readLine();

nbCommands++;
}

@Override
public List<Student> listStudents() throws IOException {
LOG.log(Level.INFO, "Listing the students...");

writeInWriter(RouletteV2Protocol.CMD_LIST);

nbCommands++;

return JsonObjectMapper.parseJson(reader.readLine(), ListStudentCommandResponse.class).getStudents();
}

@Override
public int getNumberOfStudentAdded() throws IOException {
return nbNewStudents;
}

@Override
public boolean checkSuccessOfCommand() throws IOException {
return statusLastCommand;
}

@Override
public void loadStudent(String fullname) throws IOException {
LOG.log(Level.INFO, "Loading student " + fullname);

writeInWriter(RouletteV2Protocol.CMD_LOAD);

reader.readLine();

writeInWriter(fullname);
writeInWriter(RouletteV2Protocol.CMD_LOAD_ENDOFDATA_MARKER);

// String responseReader = reader.readLine();

LoadCommandResponse response = JsonObjectMapper.parseJson(reader.readLine(), LoadCommandResponse.class);
statusLastCommand = response.getStatus().equals("success");

if(statusLastCommand)
nbNewStudents = response.getNumberOfNewStudents();

nbCommands++;
}

@Override
public void loadStudents(List<Student> students) throws IOException {
LOG.log(Level.INFO, "Loading a list of students");

writeInWriter(RouletteV2Protocol.CMD_LOAD);

reader.readLine();

for (Student student : students)
writeInWriter(student.getFullname());

writeInWriter(RouletteV2Protocol.CMD_LOAD_ENDOFDATA_MARKER);

LoadCommandResponse response = JsonObjectMapper.parseJson(reader.readLine(), LoadCommandResponse.class);
statusLastCommand = response.getStatus().equals("success");

if(statusLastCommand)
nbNewStudents = response.getNumberOfNewStudents();

nbCommands++;
}

@Override
public void clearDataStore() throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public List<Student> listStudents() throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

}
}
Loading