     (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 "robotandbaby.pdf")))
-    (is (.exists (io/file tmpdir "robotandbaby.pdf.b64")))
-    (is (.exists (io/file tmpdir "filename")))
-    (is (.exists (io/file tmpdir "uuid")))
-
+
+    (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 "robotandbaby.pdf"))
-           (fs/size (io/file "resources" "robotandbaby.pdf"))
-           ))
+           (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 (-> (slurp (io/file tmpdir "filename"))
-            (= "resources/robotandbaby.pdf")
-            ))
+    (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)
     )
   )

                                              (-> metadata :headers (assoc "UUID" (.toString tmpdir)))))
          [mods tmpdir-0] (h/parse-mods-files (h/save-marcxml2mods-response [actual-metadata payload]))
          [oai_dcs tmpdir-1] (h/mods->oai_dcs [mods tmpdir-0])
          [fname result-tmpdir] (h/make-foxml [mods tmpdir-0] [oai_dcs tmpdir-1])
          uuid (slurp (io/file result-tmpdir "uuid"))
          ]


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