Salome HOME
Check modification dates in the unit test of a document replacing.
[tools/siman.git] / Workspace / Siman-Common / src / test / splat / service / TestStepService.java
index a50c23bad9a4669fedccf45e2df9e62b8439e0c1..0908b242b85989fc8e37d9687cefa8f135f8166b 100644 (file)
@@ -9,7 +9,6 @@
 package test.splat.service;
 
 import java.io.FileNotFoundException;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.sql.SQLException;
 import java.util.ArrayList;
@@ -594,92 +593,6 @@ public class TestStepService extends BaseTest {
                LOG.debug(">>>>> END testRemoveDocumentVersion()");
        }
 
-       /**
-        * Create a document and publish it in the project element.
-        * 
-        * @param aProjElem
-        *            the project element
-        * @param aStep
-        *            the project element step
-        * @param docname
-        *            document name
-        * @param dtype
-        *            document type
-        * @return publication of the created document
-        * @throws BusinessException
-        *             if document creation is failed
-        * @throws IOException
-        *             if file creation is failed
-        */
-       private Publication addDoc(final ProjectElement aProjElem,
-                       final org.splat.som.Step aStep, final String docname,
-                       final DocumentType dtype) throws BusinessException, IOException {
-               HibernateTemplate ht = getHibernateTemplate();
-               // Add documents to the study activity
-               Document.Properties dprop = new Document.Properties().setAuthor(
-                               aProjElem.getAuthor()).setDate(new Date()).setName(docname)
-                               .setType(dtype).setFormat("py");
-               dprop.setLocalPath(dprop.getName() + "." + dprop.getFormat());
-               dprop.setStep(aStep.getStep());
-               Publication pub = _stepService.createDocument(aStep, dprop);
-               pub.setStep(aStep);
-               aProjElem.add(pub);
-               aStep.getDocuments().add(pub);
-               ht.saveOrUpdate(pub);
-               ht.save(pub.value());
-               // Add a converts relation
-               // Attach a med file
-               ht.saveOrUpdate(_publicationService.attach(pub, "med"));
-               String filepath = pub.getSourceFile().asFile().getAbsolutePath();
-               createFile(filepath);
-               createFile(filepath.substring(0, filepath.lastIndexOf(".")) + ".med");
-               return pub;
-       }
-
-       /**
-        * Create a file.
-        * 
-        * @param fname
-        *            file name
-        * @throws IOException
-        *             if file creation failed
-        */
-       private void createFile(final String fname) throws IOException {
-               // Create a file in the download directory
-               LOG.debug("Create file: " + fname);
-               String filePath = fname;
-               FileWriter fw = new FileWriter(filePath);
-               fw.write("Simulation of " + fname + " data file at " + new Date());
-               fw.close();
-       }
-
-       /**
-        * Create a new version of the document.
-        * 
-        * @param pub
-        *            the current document publication
-        * @return the new document version publication
-        * @throws IOException
-        *             if versioning is failed
-        * @throws BusinessException
-        *             if versioning is failed
-        */
-       private Publication version(final Publication pub)
-                       throws BusinessException, IOException {
-               Document.Properties dprop = new Document.Properties();
-               dprop.setDocument(pub.value(), pub.getStep().getStep());
-               dprop.setLocalPath(pub.value().getTitle() + "_v1");
-               Publication newpub = _stepService.versionDocument(pub.getStep(), pub,
-                               dprop);
-               pub.getOwner().getDocums().remove(pub);
-               pub.getStep().getDocuments().remove(pub);
-               pub.getOwner().add(newpub);
-               pub.getStep().getDocuments().add(newpub);
-               String filepath = newpub.getSourceFile().asFile().getAbsolutePath();
-               createFile(filepath);
-               return newpub;
-       }
-
        /**
         * Create a persistent scenario for tests.
         *