Package test.serialisation

Source Code of test.serialisation.TestSocial

package test.serialisation;

import java.io.File;
import java.io.IOException;
import java.rmi.RemoteException;

import client.Client;

import com.Publication;

import profil.ProfilSocial;
import profil.Profil.Sexe;
import util.Constantes;
import util.ProfilException;

public class TestSocial {

  public static void main(String[] args) {
    File f = new File(Constantes.PROFIL);
    f.delete();
   
    try {
      Client.newProfil(new ProfilSocial("tarek.tarek13", "azerty", "JAOUANI", "Tarek", Sexe.H));
      Client.newProfil(new ProfilSocial("kevkev69", "azerty", "FRANCES", "Kévin", Sexe.H));
      Client.newProfil(new ProfilSocial("dalleria", "azerty", "DALLE-RIVE", "Antoine", Sexe.H));
      Client.newProfil(new ProfilSocial("calleay", "azerty", "CALLEA", "Yohann", Sexe.H));
      Client.newProfil(new ProfilSocial("bab", "azerty", "CISSE", "Babacar", Sexe.H));
      Client.newProfil(new ProfilSocial("aitmachin", "azerty", "AIT-MAMA", "Meryeme", Sexe.F));
    } catch (IOException e) {
      System.err.println("Une erreur est survenue durant la création d'un profil.");
      System.exit(1);
    } catch (ProfilException e) {
      System.err.println("ProfilException : " + e.getMessage());
      System.exit(1);
    }
   
   
    try {
      ProfilSocial ps = (ProfilSocial)Client.getProfil("tarek.tarek13");
      ps.addPublication(new Publication("tarek.tarek13", "Ceci est une publication!"));
     
      Client.modifyProfil("tarek.tarek13", ps);
     
      ps = (ProfilSocial)Client.getProfil("tarek.tarek13");
      System.out.println(ps.getPublications().get(0).toString());
    } catch (RemoteException e) {
      System.err.println("RemoteEX");
      System.exit(1);
    } catch (ProfilException e) {
      System.err.println("ProfilException : " + e.getMessage());
      System.exit(1);
    }
  }

}
TOP

Related Classes of test.serialisation.TestSocial

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.