feat: 1 teste nul fix: des ptits trucs parciparla

This commit is contained in:
gdamms 2021-12-02 22:39:29 +01:00
parent 288b43ffe6
commit f2d318d3f7
3 changed files with 52 additions and 4 deletions

View file

@ -5,8 +5,6 @@ import java.util.Collection;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.*;
import java.rmi.registry.*;
import java.io.*;
import linda.Callback;
import linda.Linda;
@ -23,7 +21,7 @@ public class LindaServer extends UnicastRemoteObject implements LindaRemote {
public static void main(String[] args) {
try {
LindaServer ls = new LindaServer();
Registry registry = LocateRegistry.createRegistry(Integer.parseInt(args[1]));
LocateRegistry.createRegistry(Integer.parseInt(args[1]));
Naming.rebind(args[0], ls);
System.out.println("L'instance Linda a été publié sur le registre (" + args[0] + ") !\n");
} catch (Exception e) {
@ -37,7 +35,6 @@ public class LindaServer extends UnicastRemoteObject implements LindaRemote {
public void write(Tuple t) {
lindaInstance.write(t);
System.out.println("Le tuple " + t + " a été ajouté au TupleSpace !");
}
public Tuple take(Tuple template) throws RemoteException {

View file

@ -0,0 +1,30 @@
package linda.test;
import linda.server.LindaClient;
import linda.Tuple;
public class ClientTest1 {
public static void main(String[] args) {
LindaClient lc = new LindaClient(args[0]);
Tuple t1 = new Tuple(1, "a");
System.out.print("Tuple " + t1 + " envoyé");
lc.write(t1);
System.out.print("Tuple " + t1 + " écrit");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Tuple template = new Tuple(Integer.class, String.class);
System.out.print("Lecture " + template + " envoyé");
Tuple t2 = lc.read(template);
System.out.print("Tuple " + t2 + " lu");
}
}

View file

@ -0,0 +1,21 @@
package linda.test;
import linda.server.LindaServer;
import java.rmi.*;
import java.rmi.registry.*;
public class ServerTest {
public static void main(String[] args) {
try {
LindaServer ls = new LindaServer();
LocateRegistry.createRegistry(Integer.parseInt(args[1]));
Naming.rebind(args[0], ls);
System.out.println("L'instance Linda a été publié sur le registre (" + args[0] + ") !\n");
} catch (Exception e) {
e.printStackTrace();
}
}
}