Package de.chris_soft.nanoarchive

Examples of de.chris_soft.nanoarchive.DB


   * @throws SQLException
   * @throws IOException
   */
  @Test
  public void testPaths() throws ClassNotFoundException, SQLException, IOException {
    DB db = new DB(DB_PATH);
    db.addDocument(3312, 0, SAMPLE_DOCUMENT_FILE);
    long pathID = db.addPath("neuer Pfad", -1);
    List<Pair<Long, String>> paths = db.getChildPaths(0);
    assertEquals(1, paths.size());
    assertEquals(pathID, paths.get(0).obj1.longValue());
    assertEquals("neuer Pfad", paths.get(0).obj2);
    assertEquals(1, db.getDocumentsFromPath(-1).size());
    db.changeDocumentPath(3312, pathID);
    assertEquals(0, db.getDocumentsFromPath(0).size());
    assertEquals(1, db.getDocumentsFromPath(pathID).size());
    db.deletePath(pathID);
    assertEquals(1, db.getDocumentsFromPath(0).size());
    assertEquals(0, db.getDocumentsFromPath(pathID).size());
    db.close();
  }
View Full Code Here


   * @throws SQLException
   * @throws IOException
   */
  @Test
  public void testPaths2() throws ClassNotFoundException, SQLException, IOException {
    DB db = new DB(DB_PATH);
    long pathID1 = db.addPath("neuer Pfad 1", -1);
    long pathID2 = db.addPath("neuer Pfad 2", -1);
    long pathID3 = db.addPath("neuer Pfad 3", pathID2);
    db.addDocument(-1, 0, SAMPLE_DOCUMENT_FILE);
    db.addDocument(-1, pathID1, SAMPLE_DOCUMENT_FILE);
    db.addDocument(-1, pathID2, SAMPLE_DOCUMENT_FILE);
    db.addDocument(-1, pathID3, SAMPLE_DOCUMENT_FILE);
    assertEquals(2, db.getDocumentsFromPath(0).size());
    assertEquals(1, db.getDocumentsFromPath(pathID1).size());
    assertEquals(1, db.getDocumentsFromPath(pathID2).size());
    assertEquals(1, db.getDocumentsFromPath(pathID3).size());
    db.deletePath(pathID2);
    assertEquals(4, db.getDocumentsFromPath(0).size());
    assertEquals(1, db.getDocumentsFromPath(pathID1).size());
    db.close();
  }
View Full Code Here

   * @throws SQLException
   * @throws IOException
   */
  @Test
  public void testLabels() throws ClassNotFoundException, SQLException, IOException {
    DB db = new DB(DB_PATH);
    long labelID = db.createLabel("lucas");
    assertEquals("lucas", db.getLabelName(labelID));
    db.addLabelToDocument(3312L, labelID);
    List<Long> list = db.getDocumentsFromLabel(labelID);
    assertEquals(1, list.size());
    assertEquals(3312L, list.get(0).longValue());
    db.deleteLabel(labelID);
    list = db.getDocumentsFromLabel(labelID);
    assertEquals(0, list.size());
    labelID = db.createLabel("luisa");
    db.addLabelToDocument(3312L, labelID);
    list = db.getDocumentsFromLabel(labelID);
    assertEquals(1, list.size());
    assertEquals(3312L, list.get(0).longValue());
    list = db.getLabelsFromDocument(3312L);
    assertEquals(1, list.size());
    assertEquals(labelID, list.get(0).longValue());
    db.removeLabelFromDocument(3312L, labelID);
    list = db.getLabelsFromDocument(3312L);
    assertEquals(0, list.size());
    db.close();
  }
View Full Code Here

   * @throws SQLException
   * @throws ClassNotFoundException
   */
  // @Test
  public void _testListDocuments() throws SQLException, ClassNotFoundException {
    DB db = new DB(DB_PATH);
    db.printSelection("select * from DOCUMENTS");
    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.