示例#1
0
  @Test
  public void testCreateAnbieter() throws AlreadyInUseException, IOException {
    acv = Portal.Accountverwaltung();
    acv.createAnbieter("*****@*****.**", "Anbieter", "AnbieterPasswort");

    ArrayList<Anbieter> anbieter = acv.getAnbieter();
    Assert.assertEquals(
        1,
        anbieter.size()); // habe ich auch wirklich nur einen erstellt, wenn nicht fehler im setup?

    Anbieter bieter = anbieter.get(0);

    Assert.assertEquals("Anbieter", bieter.getName());
    Assert.assertEquals("*****@*****.**", bieter.getEmail());
    Assert.assertEquals(Account.hashPassword("AnbieterPasswort"), bieter.getPassword());
  }
示例#2
0
  @Test
  public void testeCreateBetreiber() throws AlreadyInUseException, IOException {
    acv = Portal.Accountverwaltung();
    acv.createBetreiber("*****@*****.**", "Betreiber", "BetreiberPasswort");

    ArrayList<Betreiber> betreiber = acv.getBetreiber();
    Assert.assertEquals(
        1,
        betreiber.size()); // habe ich auch wirklich nur einen erstellt, wenn nicht fehler im setup?

    Betreiber treiber = betreiber.get(0);

    Assert.assertEquals("Betreiber", treiber.getName());
    Assert.assertEquals("*****@*****.**", treiber.getEmail());
    Assert.assertEquals(Account.hashPassword("BetreiberPasswort"), treiber.getPassword());
  }
示例#3
0
  @Test
  public void testCreateKunde() throws AlreadyInUseException, IOException {
    acv = Portal.Accountverwaltung();
    acv.createKunde("*****@*****.**", "Kunde", "KundenPasswort");

    ArrayList<Kunde> kunden = acv.getKunden();
    Assert.assertEquals(
        1,
        kunden
            .size()); // habe ich auch wirklich nur einen erstellt, wenn nicht fehler im
                      // setup?Assert.assertEquals(1, kunden.size());									// habe ich auch
                      // wirklich nur einen erstellt, wenn nicht fehler im setup?

    Kunde kunde = kunden.get(0);
    Assert.assertEquals("Kunde", kunde.getName());
    Assert.assertEquals("*****@*****.**", kunde.getEmail());
    Assert.assertEquals(Account.hashPassword("KundenPasswort"), kunde.getPassword());
  }
  @Test
  public void generateExcelPoiReport() throws IOException {

    Workbook wb = new HSSFWorkbook();
    Sheet sheet = wb.createSheet("Accounts");

    int rowNum = 1;
    Row row = sheet.createRow(rowNum++);

    Font font = wb.createFont();
    font.setFontHeightInPoints((short) 24);
    font.setFontName(FONT_TYPE);
    font.setColor(FONT_COLOR_TITLE);

    /** * Header **** */
    CellStyle style = wb.createCellStyle();
    style.setFont(font);
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    style.setFillForegroundColor(BACKGROUND_COLOR);

    Cell cell = row.createCell((short) 1);
    cell.setCellValue("Account Report per Beneficiary");
    cell.setCellStyle(style);
    sheet.addMergedRegion(
        new CellRangeAddress(
            1, // first row (0-based)
            2, // last row  (0-based)
            1, // first column (0-based)
            16 // last column  (0-based)
            ));

    /** * Body **** */
    font = wb.createFont();
    font.setFontHeightInPoints((short) 12);
    font.setFontName(FONT_TYPE);
    font.setColor(FONT_COLOR);

    style = wb.createCellStyle();
    style.setFont(font);

    rowNum = rowNum + 3;
    List<Account> accounts = accountManager.getAllAccounts();
    for (Account account : accounts) {

      row = sheet.createRow(rowNum++);

      cell = row.createCell((short) 1);
      cell.setCellStyle(style);
      cell.setCellValue(account.getName());

      cell = row.createCell((short) 2);
      cell.setCellValue(account.getNumber());
      cell.setCellStyle(style);

      cell = row.createCell((short) 3);
      cell.setCellValue(account.getEntityId());
      cell.setCellStyle(style);
    }

    sheet.autoSizeColumn(1);
    sheet.autoSizeColumn(2);
    sheet.autoSizeColumn(3);

    // Write the output to a file
    FileOutputStream fileOut = new FileOutputStream("C:/Temp/workbook.xls");
    wb.write(fileOut);
    fileOut.close();
  }