예제 #1
0
  /**
   * Metoda nastavujici do jTextFieldu "person" informace o danem uzivateli.
   *
   * @throws java.rmi.RemoteException
   * @throws java.rmi.NotBoundException
   * @throws java.io.FileNotFoundException
   */
  private void setPerson() {
    User user = null;
    user = view.getUserById(userId);

    if (user != null) {
      jTextFieldPerson.setText(user.getLastName() + ", " + user.getFirstName());
    }
  }
예제 #2
0
 @Test
 public void TestCreateIncome() {
   boolean result;
   result =
       icInst.createIncome(date, material.getMaterialId(), 0.0, 1.0, user.getUserId(), "testNote");
   assertEquals(true, result);
   result = icInst.createIncome(date, 0, 0.0, 1.0, user.getUserId(), "testNote");
   assertEquals(false, result);
   result = icInst.createIncome(date, material.getMaterialId(), 0.0, 1.0, 0, "testNote");
   assertEquals(false, result);
 }
예제 #3
0
  @Test
  public void TestUpdateIncome() {
    boolean result;

    Income income = null;
    Object[][] temp = icInst.getIncomes();
    if (temp != null && temp.length > 0) {
      for (int i = 0; i < temp.length; i++) {
        if (temp[i][2].equals("testName")
            && temp[i][6].equals("testUsername")
            && temp[i][7].equals("testNote")) {
          income = icInst.getIncomeByID(Integer.parseInt(temp[i][0].toString()));
        }
      }
    }
    if (income == null) fail();

    result =
        icInst.updateIncome(
            income.getIncomeId(),
            date,
            material.getMaterialId(),
            1.0,
            2.0,
            user.getUserId(),
            "testNote");
    assertEquals(true, result);
    result =
        icInst.updateIncome(
            0, date, material.getMaterialId(), 1.0, 2.0, user.getUserId(), "testNote");
    assertEquals(false, result);
    result =
        icInst.updateIncome(income.getIncomeId(), date, 0, 1.0, 2.0, user.getUserId(), "testNote");
    assertEquals(false, result);
    result =
        icInst.updateIncome(
            income.getIncomeId(), date, material.getMaterialId(), 1.0, 2.0, 0, "testNote");
    assertEquals(false, result);
  }
예제 #4
0
  @AfterClass
  public static void tearDownClass() throws Exception {
    Income income = null;
    Object[][] temp = icInst.getIncomes();
    if (temp != null && temp.length > 0) {
      for (int i = 0; i < temp.length; i++) {
        if (temp[i][2].equals("testName")
            && temp[i][6].equals("testUsername")
            && temp[i][7].equals("testNote")) {
          income = icInst.getIncomeByID(Integer.parseInt(temp[i][0].toString()));
        }
      }
    }

    if (income != null) income.delete();
    if (user != null) user.delete();
    if (material != null) material.delete();
    if (materialType != null) materialType.delete();
  }