コード例 #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);
 }