                      xml/parse
                      zip/xml-zip
                      )]
+        ;(def root (-> (io/file "/tmp/aa.xml") io/input-stream xml/parse zip/xml-zip))
+        (let [ref (zx/xml1-> root :datastream [(zx/attr= :ID "IMG_FULL")] :datastreamVersion :contentLocation (zx/attr :REF)) ]
+          (is (= (.toString (io/file "file:/var/fedora/import/" uuid "img" (-> full-file :filename))) ref))
+          )
+        (let [ref (zx/xml1-> root :datastream [(zx/attr= :ID "IMG_PREVIEW")] :datastreamVersion :contentLocation (zx/attr :REF)) ]
+          (is (= (.toString (io/file "file:/var/fedora/import/" uuid "img" (-> preview-file :filename))) ref))
+          )
         )
+
       ;(pp/pprint result-tmpdir)
       ;(println (slurp (io/file result-tmpdir uuid (str uuid ".xml"))))
       )
 
-    (fs/delete-dir tmpdir)
-    )
-  )
+    ;(fs/delete-dir tmpdir)
+    )
+  )
+
+
+
+
+
+
+
+
+
+

          
          [oai_dcs response-tmpdir] (-> (h/save-marcxml2mods-response [actual-metadata payload])
                                        h/parse-mods-files
                                        h/mods->oai_dcs
                                        )
          ]

    (def result (h/save-request  [[nil payload] tmpdir]))

    (is (.exists tmpdir))
    (is (.exists (io/file tmpdir "uuid")))
    (is (.exists (io/file tmpdir "urnnbn")))
    (is (.exists (io/file tmpdir "oai_marc.xml")))
    (is (.exists (io/file tmpdir "oai_marc.xml.b64")))

    (is (.exists (io/file tmpdir "img_full")))
    (is (.exists (io/file tmpdir "img_full" "robotandbaby.pdf")))
    (is (.exists (io/file tmpdir "img_full" "mimetype")))
    (is (.exists (io/file tmpdir "img_full" "filename")))

    (is (.exists (io/file tmpdir "img_preview")))
    (is (.exists (io/file tmpdir "img_preview" "robotandbaby_001.jpg")))
    (is (.exists (io/file tmpdir "img_preview" "mimetype")))
    (is (.exists (io/file tmpdir "img_preview" "filename")))
    
    (is (= (fs/size (io/file tmpdir "oai_marc.xml"))
           (fs/size (io/file "resources" "oai_marc.xml"))))

    (is (= (fs/size (io/file tmpdir "img_full" "robotandbaby.pdf"))
           (fs/size (io/file "resources" "robotandbaby.pdf"))))

    (is (= (fs/size (io/file tmpdir "img_preview" "robotandbaby_001.jpg"))
           (fs/size (io/file "resources" "robotandbaby_001.jpg"))))
    
    (is (= "e65d9072-2c9b-11e5-99fd-b8763f0a3d61" (slurp (io/file tmpdir "uuid"))))
    (is (= "urn:nbn:cz:mzk-0005ol" (slurp (io/file tmpdir "urnnbn"))))

    (is (= "robotandbaby.pdf" (slurp (io/file tmpdir "img_full" "filename"))))
    (is (= "application/pdf" (slurp (io/file tmpdir "img_full" "mimetype"))))
    (is (= "robotandbaby_001.jpg" (slurp (io/file tmpdir "img_preview" "filename"))))
    (is (= "image/jpeg" (slurp (io/file tmpdir "img_preview" "mimetype"))))

    (fs/delete-dir tmpdir)
    )
  )
