Exemplo n.º 1
0
  @SuppressWarnings("deprecation")
  @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");

    ingrediente = new Ingrediente();
    ingrediente.setNome("INGREDIENTE TEST");
    ingrediente.setScadenza(new Date(109, 4, 31));
    ingrediente.setVariante(true);

    ingrediente = articoloFacade.inserisciIngrediente(user, ingrediente);
  }
Exemplo n.º 2
0
  @SuppressWarnings("deprecation")
  @Test
  public void testUpdateIngrediente() {
    User user_test = null;
    try {
      user_test = userFacade.login(Ruolo.CAMERIERE, "1234");
    } catch (RemoteException e) {
      user_test = null;
    }

    Ingrediente ingrediente_test = ingrediente;
    ingrediente_test.setNome("INGREDIENTE TEST");
    ingrediente_test.setScadenza(new Date(109, 4, 31));
    ingrediente_test.setVariante(true);
    boolean test_return = false;
    try {
      test_return = articoloFacade.updateIngrediente(user_test, ingrediente_test);
    } catch (AccessControlException e) {
      test_return = false;
    } catch (RemoteException e) {
      fail("RemoteException");
    }

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

    assertFalse(test_return);
  }
Exemplo n.º 3
0
  @SuppressWarnings("deprecation")
  @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"); // CONTROLLARE
      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");

    ingrediente = new Ingrediente();
    ingrediente.setDescrizione("Ingrediente di test");
    ingrediente.setId((long) 1000000L);
    ingrediente.setNome("Ingrediente di Test");
    ingrediente.setTipoIngrediente("IngredienteLungaConservazione");
    ingrediente.setScadenza(new Date(109, 1, 21));
    ingrediente.setUnitaMisura("g");
    ingrediente.setVariante(true);

    ingrediente = articoloFacade.inserisciIngrediente(user, ingrediente);
  }