]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
File id is added to the checked out info.
authorrkv <rkv@opencascade.com>
Thu, 29 Nov 2012 12:02:54 +0000 (12:02 +0000)
committerrkv <rkv@opencascade.com>
Thu, 29 Nov 2012 12:02:54 +0000 (12:02 +0000)
Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java
Workspace/Siman-Common/src/org/splat/service/dto/DocumentDTO.java
Workspace/Siman-Common/src/org/splat/service/dto/FileDTO.java
Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java
Workspace/Siman-Common/testng_checkout.xml [new file with mode: 0644]

index 1ebc962ef1efc0fb0afc19e521300afc963bb361..70714a69bd74607bf2a3065f7f3761a877e35f2c 100644 (file)
@@ -242,12 +242,13 @@ public class ScenarioServiceImpl implements ScenarioService {
                                } else {
                                        processing = "file-download";
                                }
-                               docDTO.addFile(tag.value().getFile().getRelativePath(), aState,
-                                               processing, false);
+                               File aFile = tag.value().getFile();
+                               docDTO.addFile(aFile.getIndex(), aFile.getRelativePath(),
+                                               aState, processing, false);
                                // Process all exported files
                                for (Relation rel : tag.value().getRelations(
                                                ConvertsRelation.class)) {
-                                       File aFile = ((ConvertsRelation) rel).getTo();
+                                       aFile = ((ConvertsRelation) rel).getTo();
                                        fileFormat = aFile.getFormat();
                                        doImport = getProjectSettings().doImport(docType,
                                                        fileFormat);
@@ -256,8 +257,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                                        } else {
                                                processing = "file-download";
                                        }
-                                       docDTO.addFile(aFile.getRelativePath(), aState, processing,
-                                                       false);
+                                       docDTO.addFile(aFile.getIndex(), aFile.getRelativePath(),
+                                                       aState, processing, false);
                                }
                        }
                }
index 7e7f4c33428ee7a5fc6dacac342ca291d84eeefd..29d6fdbe0165bb95d29068ee51f72ffb2e509a3c 100644 (file)
@@ -100,6 +100,8 @@ public class DocumentDTO {
        /**
         * Add a new file DTO.
         * 
+        * @param id
+        *            file persistent id
         * @param relativePath
         *            relative file path
         * @param state
@@ -110,9 +112,9 @@ public class DocumentDTO {
         *            true if the file is result
         * @return the added file DTO
         */
-       public FileDTO addFile(final String relativePath, final char state,
+       public FileDTO addFile(final long id, final String relativePath, final char state,
                        final String processing, final boolean isResult) {
-               FileDTO fileDTO = new FileDTO(relativePath, state, processing, isResult);
+               FileDTO fileDTO = new FileDTO(id, relativePath, state, processing, isResult);
                _files.add(fileDTO);
                return fileDTO;
        }
index 99405b640ab0855492febe49fd421aa30f8715b1..4a679caf24b052ee534a8907323d793d28313cac 100644 (file)
@@ -15,6 +15,10 @@ package org.splat.service.dto;
  */
 public class FileDTO {
 
+       /**
+        * File persistent id.
+        */
+       private Long _id;
        /**
         * True if the file is a result file for a document.
         */
@@ -35,6 +39,8 @@ public class FileDTO {
        /**
         * Constructor with initialization.
         * 
+        * @param id
+        *            file persistent id
         * @param relativePath
         *            relative file path
         * @param state
@@ -44,14 +50,15 @@ public class FileDTO {
         * @param isResult
         *            true if the file is result
         */
-       public FileDTO(final String relativePath, final char state,
+       public FileDTO(final long id, final String relativePath, final char state,
                        final String processing, final boolean isResult) {
+               _id = id;
                _path = relativePath;
                _state = state;
                _processing = processing;
                _isResult = isResult;
        }
-       
+
        /**
         * Constructor with partial initialization.
         * 
@@ -156,10 +163,30 @@ public class FileDTO {
                        fstate = "file-outdated";
                }
                buf.append(indent).append(ftype).append(" file: ").append(getPath())
-                               .append('\n').append(indent).append(
+                               .append('\n').append(indent).append("    File ID: ").append(
+                                               getId()).append('\n').append(indent).append(
                                                "    Automatic processing: ").append(getProcessing())
                                .append('\n').append(indent).append("    State: ").append(
                                                fstate).append('\n');
                return buf.toString();
        }
+
+       /**
+        * Get the id.
+        * 
+        * @return the id
+        */
+       public Long getId() {
+               return _id;
+       }
+
+       /**
+        * Set the id.
+        * 
+        * @param id
+        *            the id to set
+        */
+       public void setId(final Long id) {
+               _id = id;
+       }
 }
index 3670fa28dc249bb983ebd20dcc79b3fa78510328..d064e2fd3c00cb497ff4bdd0622cb685f7817ada 100644 (file)
@@ -151,7 +151,7 @@ public class TestScenarioService extends BaseTest {
         * @throws SQLException
         *             if scenario creation is failed
         */
-       @Test
+       @Test(groups = { "checkout", "sevice", "functional", "business" })
        public void testGetScenarioInfo() throws InvalidPropertyException,
                        MissedPropertyException, MultiplyDefinedException, IOException,
                        SQLException {
diff --git a/Workspace/Siman-Common/testng_checkout.xml b/Workspace/Siman-Common/testng_checkout.xml
new file mode 100644 (file)
index 0000000..9a3dd6f
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="SimanCommonTests" verbose="1">
+       <test name="all">
+               <method-selectors>
+                       <method-selector>
+                               <script language="beanshell">
+                                       <![CDATA[
+                (groups.containsKey("checkout")) && method.getName().toUpperCase().startsWith("TEST")             
+              ]]>
+                               </script>
+                       </method-selector>
+               </method-selectors>
+        <groups>
+            <!-- 
+                <define name="all">
+                <include name="business"/>
+                <include name="functional"/>
+                <include name="service"/>
+                </define>
+                <define name="new">
+                <include name="newservice"/>
+                </define>
+                <run>
+                <include name="all"/>
+                <exclude name="old"/>
+                </run>
+            -->
+
+        </groups>
+               <packages>
+                       <package name="test.*" />
+               </packages>
+       </test>
+</suite>