示例#1
0
文件: TC3.java 项目: asilipo/softfood
  @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);
  }
示例#2
0
文件: TC3.java 项目: asilipo/softfood
  @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);
  }
示例#3
0
文件: TC2.java 项目: asilipo/softfood
  @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);
  }