@Test之后的回滚事务(Rollback transaction after @Test)
首先,我已经在StackOverflow上找到了很多关于这一点的线程,但是他们都没有真正帮助我,所以很抱歉要问可能的重复问题。
我使用spring-test运行JUnit测试,我的代码看起来像这样
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {}) public class StudentSystemTest { @Autowired private StudentSystem studentSystem; @Before public void initTest() { // set up the database, create basic structure for testing } @Test public void test1() { } ... }
我的问题是我希望我的测试不会影响其他测试。 所以我想为每个测试创建一些回滚的东西。 我已经搜索了很多,但是我迄今没有找到任何东西。 我正在使用Hibernate和MySql
First of all, I've found a lot of threads on StackOverflow about this, but none of them really helped me, so sorry to ask possibly duplicate question.
I'm running JUnit tests using spring-test, my code looks like this
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {}) public class StudentSystemTest { @Autowired private StudentSystem studentSystem; @Before public void initTest() { // set up the database, create basic structure for testing } @Test public void test1() { } ... }
My problem is that I want my tests to NOT influence other tests. So I'd like to create something like rollback for each test. I've searched a lot for this, but I've found nothing so far. I'm using Hibernate and MySql for this
原文:https://stackoverflow.com/questions/12626502
最满意答案
您应该参考Sitecore 7 Scaling Guide的第3.4章,该指南建议您使用Microsoft分布式文件系统 (如Jens所指出的)或Web部署工具 。
我已经实现了几次Web Deploy解决方案并且工作得很好,但是设置起来非常困难。
上次我必须实现文件同步时,DFS解决方案不是Scaling Guide的一部分,因此我无法对此发表评论。You should refer to chapter 3.4 of the Sitecore 7 Scaling Guide which will suggest you to use Microsoft Distributed File System (as Jens pointed out) or the Web Deployment Tool.
I have implemented the Web Deploy solution a few times and that works pretty good, but it can be quite difficult to setup.
The DFS solution wasn't part of the Scaling Guide the last time I had to implement file synchronisation, so I can't comment on that.
相关问答
更多-
您应该参考Sitecore 7 Scaling Guide的第3.4章,该指南建议您使用Microsoft分布式文件系统 (如Jens所指出的)或Web部署工具 。 我已经实现了几次Web Deploy解决方案并且工作得很好,但是设置起来非常困难。 上次我必须实现文件同步时,DFS解决方案不是Scaling Guide的一部分,因此我无法对此发表评论。 You should refer to chapter 3.4 of the Sitecore 7 Scaling Guide which will sug ...
-
PyPI自动部署(PyPI automatic deployment)[2023-06-12]
您可以使用after_success:选项在travis-ci上实现自定义部署 。 就像是: after_success: "cd $subfolder && python setup.py sdist upload -r pypi" 您必须使用最适合的方法自行提供您的pypi凭证。 You can use the after_success: option to implement custom deployments on travis-ci. Something like: after_su ... -
多列表控件应该在内容编辑器中直接对用户可见,您不需要执行任何其他操作。 由于您使用标准值定义了一些项目,因此在首次创建该项目时将会“预先选择”这些项目。 然后,用户可以根据需要添加其他项目。 要允许用户从页面编辑器中选择值,您可以在PageEdit中使用Sitecore EditFrame 将项目呈现为原始值的原因是因为您需要获取项目然后迭代目标ID。 这里有一个例子 //Get a multilist field from the current item Sitecore.Data.Fields.Mul ...
-
无法通过sitecore azure模块部署现有的azure DB(Not able to deploy existing azure DB through sitecore azure module)[2022-06-16]
据我所知,您遇到以下问题: 创建自定义Azure SQL数据库服务以托管Sitecore数据库和自定义数据库。 Sitecore内容交付(交付场)和/或Sitecore内容管理(编辑场)应连接到此自定义服务中的数据库。 因此,Sitecore Azure模块必须使用自定义Azure SQL数据库服务,而不是创建新服务。 如果我是对的,问题的原因可能是由于错过了您之前提到的Sitecore KB文章的第16步。 16. Recycle the Sitecore Application Pool or rese ... -
答案是您需要将TDS更新包设置设置为命令行参数的一部分,因此: msbuild.exe /p:GeneratePackage=${generatePackage};PackageAuthor=${packageAuthor};PackagePublisher=${packagePublisher};etc... 这些设置也在visual studio解决方案中设置 - > TDS项目 - >属性。 如果我可以从视觉工作室中删除它们,我没有时间进行实验,但我希望我可以。 The answer is you ...
-
我现在的问题是,在创建新构建时,使用Jenkins工作流从头开始部署环境也是不错的做法 是的,从零开始部署环境是一种好的做法。 就像你说的,詹金斯和詹金斯的管道当然可以帮助你根据你的具体要求开始和协调这个过程。 从头开始部署完整的环境是自动化最难的事情之一,如果这是自动化的,这意味着许多其他事情也是自动化的,例如基础架构,应用程序部署,应用程序配置等。 这是在现实生活中使用的东西吗? 当然是。 很多商店都这样做。 您的环境越简单,就越容易,因此,拥有一个后端应用程序的创业公司在实现这种瓦尔哈拉国家时将会遇到 ...
-
我通过从WebPI安装Web Deploy来解决此问题。 由于某种原因,当我仅独立安装Web Deploy 3.6时,服务未正确注册。 通过WebPI安装后,发布作业立即开始工作。 I fixed this by installing Web Deploy from WebPI. For some reason when I only installed Web Deploy 3.6 independently the services were not registered properly. After ...
-
Sitecore Azure必须自动为Sitecore Core,Master和Web数据库创建Azure SQL数据库服务,并将数据从本地SQL Server数据库传输到云数据库。 您使用的Sitecore Azure版本是什么? 如果您希望可以手动将Sitecore数据库导出到您自己的Azure SQL数据库服务,然后强制模块使用它们。 请查看以下文章了解更多详情: https : //github.com/olegburov/sitecore-azure-content/blob/master/art ...
-
Sitecore azure重新部署(Sitecore azure re-deployment)[2022-06-07]
我使用Sitecore Azure模块和使用Azure .NET SDK 2.5的Visual Studio看到了此错误。 尽管如此,我还没有看到SDK 2.4或2.6。 由于您无法将其他SDK版本与Sitecore Azure模块一起使用,因此您可以尝试再次运行部署。 否则,在Visual Studio中使用最新的Azure .NET SDK: https : //github.com/olegburov/sitecore-azure-content/blob/master/articles/how-to ... -
你应该使用CI工具和git一起使用 - 你可以用纯git钩子实现你的目标,但我强烈建议不要这样做。 以下是使用SemaphoreCI设置通用工作流的方法: https : //semaphoreci.com/docs/generic-deployment.html - 他们有非常好的和初学者友好的文档,如果您对CI主题有疑问,应该通过。 如果你有私人存储库(我猜你是因为你使用bb)并且你有预算,你可以使用http://codeship.com或https://circleci.com/,因为他们有免费套餐。 ...