示例#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);
  }
示例#3
0
文件: TC2.java 项目: asilipo/softfood
  @Test
  public void testValutazioneDisponibilitaBevanda() {
    User user_test = null;
    try {
      user_test = userFacade.login(Ruolo.AMMINISTRATORE, "123456");
    } catch (RemoteException e) {
      fail("RemoteException");
    }

    int test_return = 0;
    try {
      test_return = articoloFacade.selezionaDisponibilitaBevanda(user_test, bevanda.getId());
    } catch (AccessControlException e) {
      test_return = 0;
    } catch (RemoteException e) {
      fail("RemoteException");
    }

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

    assertFalse(test_return > 0);
  }
示例#4
0
文件: TC2.java 项目: asilipo/softfood
 @After
 public void tearDown() throws Exception {
   articoloFacade.rimuoviBevandaMenu(user, bevanda.getId());
   userFacade.logout(user);
 }