Package de.chris_soft.nanoarchive

Examples of de.chris_soft.nanoarchive.DB


   * @throws ClassNotFoundException
   */
  @Test
  public void testCreateNewDatabase() throws SQLException, ClassNotFoundException {
    FileUtils.deleteAll(new File(DB_PATH));
    DB db = new DB(DB_PATH);
    db.close();
  }
View Full Code Here


   * @throws SQLException
   * @throws ClassNotFoundException
   */
  // @Test
  public void _testListAllTables() throws SQLException, ClassNotFoundException {
    DB db = new DB(DB_PATH);
    db.printSelection("select * from SYS.SYSTABLES");
    db.printSelection("select * from SYS.SYSCOLUMNS");
    db.printSelection("select * from SYS.SYSCONGLOMERATES");
    db.close();
  }
View Full Code Here

   * @throws ClassNotFoundException
   * @throws IOException
   */
  @Test
  public void testCreateDocument() throws SQLException, ClassNotFoundException, IOException {
    DB db = new DB(DB_PATH);
    db.addDocument(333, 4711, SAMPLE_DOCUMENT_FILE);
    db.addDocument(334, 4712, SAMPLE_DOCUMENT_FILE);
    db.close();
  }
View Full Code Here

   * @throws ClassNotFoundException
   * @throws IOException
   */
  @Test
  public void testCreateDocumentTwice() throws SQLException, ClassNotFoundException, IOException {
    DB db = new DB(DB_PATH);
    long documentID = db.addDocument(-1, 4711, SAMPLE_DOCUMENT_FILE);
    try {
      db.addDocument(documentID, 4711, SAMPLE_DOCUMENT_FILE);
      throw new RuntimeException("Documents with identical documentID created!");
    } catch (SQLException e) {
      // Okay.
    }
    db.close();
  }
View Full Code Here

   * @throws ClassNotFoundException
   * @throws IOException
   */
  @Test
  public void testRetrieveDocument() throws SQLException, ClassNotFoundException, IOException {
    DB db = new DB(DB_PATH);
    byte[] ba = db.readDocument(333);
    assertEquals(ba.length, SAMPLE_DOCUMENT_FILE.length());
    db.close();
  }
View Full Code Here

   * @throws SQLException
   * @throws ClassNotFoundException
   */
  @Test
  public void testGetDocumentsFromPath() throws ClassNotFoundException, SQLException {
    DB db = new DB(DB_PATH);
    List<Long> docs = db.getDocumentsFromPath(4712);
    assertEquals(docs.size(), 1);
    assertEquals(docs.get(0).longValue(), 334);
    docs = db.getDocumentsFromPath(4711);
    Collections.sort(docs);
    assertEquals(docs.size(), 2);
    assertEquals(docs.get(0).longValue(), 333);
    db.close();
  }
View Full Code Here

  /**
   * @throws ClassNotFoundException
   * @throws SQLException
   */
  public void testDeleteDocument() throws ClassNotFoundException, SQLException {
    DB db = new DB(DB_PATH);
    db.deleteDocument(333);
    List<Long> docs = db.getDocumentsFromPath(4711);
    Collections.sort(docs);
    assertEquals(docs.size(), 1);
    assertNotSame(docs.get(0).longValue(), 333);
    db.close();
  }
View Full Code Here

   * @throws SQLException
   * @throws ClassNotFoundException
   */
  @Test
  public void testCountDocuments() throws SQLException, ClassNotFoundException {
    DB db = new DB(DB_PATH);
    assertEquals(2, db.getDocumentCount());
    db.close();
  }
View Full Code Here

   * @throws ClassNotFoundException
   * @throws SQLException
   */
  @Test
  public void testUpdateDocumentPath() throws ClassNotFoundException, SQLException {
    DB db = new DB(DB_PATH);
    List<Long> docs = db.getDocumentsFromPath(4712);
    assertEquals(docs.size(), 1);
    docs = db.getDocumentsFromPath(4711);
    assertEquals(docs.size(), 1);
    db.changeDocumentPath(docs.get(0), 4712);
    docs = db.getDocumentsFromPath(4712);
    assertEquals(docs.size(), 2);
    assertEquals(2, db.getDocumentCount());
    db.close();
  }
View Full Code Here

   * @throws ClassNotFoundException
   * @throws SQLException
   */
  @Test
  public void testDocumentProperties() throws ClassNotFoundException, SQLException {
    DB db = new DB(DB_PATH);
    assertNull(db.getDocumentProperty(334, "name"));
    db.setDocumentProperty(334, "name", "Wumpel Putz");
    assertEquals("Wumpel Putz", db.getDocumentProperty(334, "name"));
    db.deleteDocumentProperty(334, "name");
    assertNull(db.getDocumentProperty(334, "name"));
    db.close();
  }
View Full Code Here

TOP

Related Classes of de.chris_soft.nanoarchive.DB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.