示例#1
0
文件: TC2.java 项目: asilipo/softfood
  @Before
  public void setUp() throws Exception {
    System.setProperty("java.security.policy", "polis.policy");
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new SecurityManager());
    }
    try {
      Registry registry = LocateRegistry.getRegistry("localhost");
      articoloFacade = (IArticoloMenuFacade) registry.lookup("ArticoloFacade");
      userFacade = (IUserFacade) registry.lookup("UserFacade");
    } catch (Exception e) {
      System.err.println("Exception to obtain the reference to the remote object: " + e);
      fail("Exception");
    }

    user = userFacade.login(Ruolo.TEST, "test");

    bevanda = new Bevanda();
    bevanda.setCapacita(1000F);
    bevanda.setNome("BEVANDA TEST");
    bevanda.setTipoArticolo("Bevanda");
    bevanda.setTipoPietanza(TipoPietanza.BEVANDA.ordinal());

    bevanda = articoloFacade.inserisciBevandaMenu(user, bevanda);

    articoloFacade.inserisciBevandaMagazzino(user, bevanda.getId(), 1L, 10000);
  }
示例#2
0
文件: TC2.java 项目: asilipo/softfood
  @Test
  public void testInserimentoBevandaMenu() {
    User user_test = null;
    try {
      user_test = userFacade.login(Ruolo.AMMINISTRATORE, "123456");
    } catch (RemoteException e) {
      fail("RemoteException");
    }

    bevanda = new Bevanda();
    bevanda.setCapacita(1000F);
    bevanda.setNome("BEVNDA TEST");
    bevanda.setTipoArticolo("BEVANDA");
    bevanda.setTipoPietanza(TipoPietanza.BEVANDA.ordinal());

    try {
      bevanda = articoloFacade.inserisciBevandaMenu(user_test, bevanda);
    } catch (AccessControlException e) {
      bevanda = null;
    } catch (RemoteException e) {
      fail("RemoteException");
    }

    try {
      userFacade.logout(user_test);
    } catch (RemoteException e) {
      fail("RemoteException");
    }

    assertNull(bevanda);
  }