Package tests

Source Code of tests.TestMetier

/**
*     This file is part of eCommerce.
*
*    Foobar is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    Foobar is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with Foobar; if not, write to the Free Software
*    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*
*    2007 Matej Hausenblas matej.hausenblas@gmail.com
*
*/
package tests;

import interfaces.exceptions.MetierException;

import java.rmi.RemoteException;
import java.sql.Date;
import java.util.ArrayList;

import metier.catalogue.MetierCatalogue;
import metier.commandes.MetierCommandes;
import base.Commande;
import base.Produit;

/**
*
*/
public class TestMetier {

  /**
   * @param args
   */
  public static void main(String[] args) {

    Date d = Date.valueOf("2007-03-03");
    Commande c = new Commande("premiereCde", "Moi", d);
   
    try {
      new MetierCommandes().ajouterCommande(c);
    } catch (RemoteException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    } catch (MetierException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
   
    ArrayList<Produit> lp = new ArrayList<Produit>();
   
    try {
      //On liste tout les produits de la base
      lp = new MetierCatalogue().listerCatalogue(null);
    } catch (RemoteException e) {
      System.out.println("Probleme RMI");
      e.printStackTrace();
    } catch (MetierException e) {
      System.out.println("Probleme metier: "+e.getMessage());
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    System.out.println(lp.toString());

  }

}
TOP

Related Classes of tests.TestMetier

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.