Package de.chris_soft.nanoarchive

Examples of de.chris_soft.nanoarchive.DB.addDocument()


   * @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


   */
  @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();
  }

  /**
   * @throws SQLException
View Full Code Here

   * @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.
View Full Code Here

  @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 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);
View Full Code Here

  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());
View Full Code Here

    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());
View Full Code Here

    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());
View Full Code Here

    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);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.