@Before public void init() { notaBDAO = new NotaBDAO(); try { db = new DBAccess(); conn = db.getConnection(); notaB1 = new NotaB(); notaB1.setIdNotaB(1); notaB1.setDescrizione("asd"); notaB1.setData(cd.getTime()); notaB1.setIdStrumento(2); notaB1.setIdUtente(1); notaB2 = new NotaB(); // notaB2.setIdNotaB(2); notaB2.setDescrizione("asd"); // notaB2.setData(cd.getTime()); notaB2.setIdStrumento(2); notaB2.setIdUtente(1); } catch (DBAccessException e) { fail(e.getMessage()); } }
@Before public void init() { try { db = new DBAccess(); conn = db.getConnection(); allegato5 = new Allegato5(); allegato5.setIdAllegato(1); allegato5.setSiglaLoop("PT900"); allegato5.setServizio("a"); allegato5.setSegnaliIngresso("b"); allegato5.setUsciteTeoriche1("c"); allegato5.setUsciteReali1("d"); allegato5.setUsciteTeoriche2("e"); allegato5.setUsciteReali2("f"); allegato5.setCostruttori("g"); allegato5.setTipi("h"); allegato5.setCampi("i"); allegato5.setNumSerie("l"); allegato5.setCompilatoRapportoInefficienza(false); allegato5.setUdm("n"); allegato5a = new Allegato5(); } catch (DBAccessException e) { e.printStackTrace(); } }
public String ricavaPassword(String username) throws DAOException { if (username != null) { try { Connection conn = dbAccess.getConnection(); PreparedStatement stmt = conn.prepareStatement(SELECT_PASS); stmt.setString(1, username); ResultSet rs = stmt.executeQuery(); String pass = null; if (rs.next()) { pass = rs.getString(1); closeAll(rs, stmt); dbAccess.closeConnection(conn); return pass; } else { closeAll(rs, stmt); dbAccess.closeConnection(conn); return pass; } } catch (SQLException e) { throw new DAOException("sql.login.exception.loginDAO", e); } catch (Exception e) { throw new DAOException("login.exception.loginDAO", e); } } else { throw new DAOException("invalid.object_username.loginDAO", null); } }
public boolean ricavaUser(String username) throws DAOException { if (username != null) { try { Connection conn = dbAccess.getConnection(); PreparedStatement stmt = conn.prepareStatement(SELECT_USER); stmt.setString(1, username); ResultSet rs = stmt.executeQuery(); if (rs.next()) { closeAll(rs, stmt); dbAccess.closeConnection(conn); return true; } else { closeAll(rs, stmt); dbAccess.closeConnection(conn); return false; } } catch (SQLException e) { throw new DAOException("sql.login.exception.loginDAO", e); } catch (Exception e) { throw new DAOException("login.exception.loginDAO", e); } } else { throw new DAOException("invalid.object_username.loginDAO", null); } }
@Before public void init() { db = new DBAccess(); try { conn = db.getConnection(); sga9 = new StatementGenAllegato9(); // DEVE CORRISPONDERE AD UNO VERO NEL DATABASE allegato9 = new Allegato9(); allegato9.setIdAllegato(9); allegato9.setSigla("asd"); allegato9.setMatricola("asd"); allegato9.setCostruttore("asd"); allegato9.setDn("asd"); allegato9.setPn("asd"); allegato9.setPesoKg(1); allegato9.setTaratura("asd"); allegato9.setEnteCertificatore("asd"); allegato9.setPrePopTest("asd"); allegato9.setMolla(true); allegato9.setOtturatore(true); allegato9.setBoccaglio(true); allegato9.setSoffietto(true); allegato9.setDiscoGuidaStelo(true); allegato9.setPiattiPortaMolla(true); allegato9.setAltro("asd"); allegato9.setLavorazioniParicolari("asd"); allegato9.setUdm("asd"); } catch (DBAccessException e) { e.printStackTrace(); } }