From b34dda379f905b0e84a31143f6bf60a810981a8d Mon Sep 17 00:00:00 2001 From: rkv Date: Fri, 5 Apr 2013 07:03:18 +0000 Subject: [PATCH] Fix of unit tests taking into account sorting and new steps configuration. --- .../splat/dao/TestKnowledgeElementDAO.java | 2 +- .../src/test/splat/dao/TestStudyDAO.java | 4 +-- .../service/TestProjectSettingsService.java | 33 ++++++++++++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Workspace/Siman-Common/src/test/splat/dao/TestKnowledgeElementDAO.java b/Workspace/Siman-Common/src/test/splat/dao/TestKnowledgeElementDAO.java index 79513b4..177205d 100644 --- a/Workspace/Siman-Common/src/test/splat/dao/TestKnowledgeElementDAO.java +++ b/Workspace/Siman-Common/src/test/splat/dao/TestKnowledgeElementDAO.java @@ -134,7 +134,7 @@ public class TestKnowledgeElementDAO extends BaseTest { LOG.debug("Created second id: " + id2); - res = _knowledgeElementDAO.getAll(); + res = _knowledgeElementDAO.getAll(Order.asc("rid")); _knowledgeElementDAO.flush(); Assert.assertNotNull(res, diff --git a/Workspace/Siman-Common/src/test/splat/dao/TestStudyDAO.java b/Workspace/Siman-Common/src/test/splat/dao/TestStudyDAO.java index 9f887af..f171307 100644 --- a/Workspace/Siman-Common/src/test/splat/dao/TestStudyDAO.java +++ b/Workspace/Siman-Common/src/test/splat/dao/TestStudyDAO.java @@ -20,13 +20,13 @@ import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.Document; +import org.splat.dal.bo.som.Document.Properties; import org.splat.dal.bo.som.DocumentType; import org.splat.dal.bo.som.ProgressState; import org.splat.dal.bo.som.ProjectElement; import org.splat.dal.bo.som.Publication; import org.splat.dal.bo.som.Scenario; import org.splat.dal.bo.som.Study; -import org.splat.dal.bo.som.Document.Properties; import org.splat.dal.dao.som.Database; import org.splat.dal.dao.som.DocumentDAO; import org.splat.dal.dao.som.StudyDAO; @@ -186,7 +186,7 @@ public class TestStudyDAO extends BaseTest { LOG.debug("Created second id: " + id2); - res = _studyDAO.getAll(); + res = _studyDAO.getAll(Order.asc("rid")); _studyDAO.flush(); Assert.assertNotNull(res, diff --git a/Workspace/Siman-Common/src/test/splat/service/TestProjectSettingsService.java b/Workspace/Siman-Common/src/test/splat/service/TestProjectSettingsService.java index 5d9e769..74ae783 100644 --- a/Workspace/Siman-Common/src/test/splat/service/TestProjectSettingsService.java +++ b/Workspace/Siman-Common/src/test/splat/service/TestProjectSettingsService.java @@ -22,8 +22,8 @@ import org.splat.service.DocumentTypeService; import org.splat.service.KnowledgeElementTypeService; import org.splat.service.SimulationContextService; import org.splat.service.technical.ProjectSettingsService; -import org.splat.service.technical.StepsConfigService; import org.splat.service.technical.ProjectSettingsService.Step; +import org.splat.service.technical.StepsConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.dao.DuplicateKeyException; @@ -378,6 +378,37 @@ public class TestProjectSettingsService extends BaseTest { .getDefaultDocumentType(step, "xml").getName(), "memorandum"); break; + case 6: + Assert.assertEquals(defTypes.size(), 2); + Assert.assertNull(_projectSettings.getDefaultDocumentType( + step, "pdf")); + Assert.assertNull(_projectSettings + .getDefaultDocumentType(step, "med")); + Assert.assertNotNull(_projectSettings + .getDefaultDocumentType(step, "py")); + Assert.assertEquals(_projectSettings + .getDefaultDocumentType(step, "py").getName(), + "visualisation"); + Assert.assertNotNull(_projectSettings + .getDefaultDocumentType(step, "srd")); + Assert.assertEquals(_projectSettings + .getDefaultDocumentType(step, "srd").getName(), + "coparisonResult"); + break; + case 7: + Assert.assertEquals(defTypes.size(), 1); + Assert.assertNull(_projectSettings.getDefaultDocumentType( + step, "pdf")); + Assert.assertNull(_projectSettings + .getDefaultDocumentType(step, "med")); + Assert.assertNull(_projectSettings + .getDefaultDocumentType(step, "py")); + Assert.assertNotNull(_projectSettings + .getDefaultDocumentType(step, "xml")); + Assert.assertEquals(_projectSettings + .getDefaultDocumentType(step, "xml").getName(), + "schema"); + break; default: Assert.assertEquals(defTypes.size(), 0); Assert.assertNull(_projectSettings.getDefaultDocumentType( -- 2.39.2