This is an automated email from the ASF dual-hosted git repository. juanpablo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/jspwiki.git
The following commit(s) were added to refs/heads/master by this push: new d3a7312 another stab at fixing test flakiness: d3a7312 is described below commit d3a731288d58ac3461d7467f7a6020de348a6221 Author: juanpablo <juanpa...@apache.org> AuthorDate: Wed Dec 9 14:56:31 2020 +0100 another stab at fixing test flakiness: * DecisionQueueTest empties the decission queue before adding new elements in order to ensure we're working with the same amount of decissions on each test * WorkflowManagerTest reads the wkflmgr.ser file from src/test/resources on testSerializeUnserialize(), to ensure we read the expected information for the test --- .../test/java/org/apache/wiki/workflow/DecisionQueueTest.java | 9 +++++---- .../test/java/org/apache/wiki/workflow/WorkflowManagerTest.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java b/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java index 73c48c4..d2c08b6 100644 --- a/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java +++ b/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java @@ -32,9 +32,9 @@ import java.util.Collection; public class DecisionQueueTest { - TestEngine m_engine; + TestEngine m_engine = TestEngine.build(); - DecisionQueue m_queue; + DecisionQueue m_queue = m_engine.getManager( WorkflowManager.class ).getDecisionQueue(); Workflow w; @@ -50,14 +50,15 @@ public class DecisionQueueTest { @BeforeEach public void setUp() throws Exception { - m_engine = TestEngine.build(); - m_queue = m_engine.getManager( WorkflowManager.class ).getDecisionQueue(); adminSession = m_engine.adminSession(); janneSession = m_engine.janneSession(); w = new Workflow("workflow.key", new WikiPrincipal("Owner1")); d1 = new SimpleDecision( w.getId(), w.getAttributes(), "decision1.key", new GroupPrincipal( "Admin" ) ); d2 = new SimpleDecision( w.getId(), w.getAttributes(), "decision2.key", new WikiPrincipal( "Owner2" ) ); d3 = new SimpleDecision( w.getId(), w.getAttributes(), "decision3.key", janneSession.getUserPrincipal() ); + while( m_queue.decisions().length != 0 ) { + m_queue.remove( m_queue.decisions()[0] ); + } m_queue.add( d1 ); m_queue.add( d2 ); m_queue.add( d3 ); diff --git a/jspwiki-main/src/test/java/org/apache/wiki/workflow/WorkflowManagerTest.java b/jspwiki-main/src/test/java/org/apache/wiki/workflow/WorkflowManagerTest.java index 0117aa2..9e8f871 100644 --- a/jspwiki-main/src/test/java/org/apache/wiki/workflow/WorkflowManagerTest.java +++ b/jspwiki-main/src/test/java/org/apache/wiki/workflow/WorkflowManagerTest.java @@ -106,7 +106,7 @@ public class WorkflowManagerTest { final DefaultWorkflowManager dwm = new DefaultWorkflowManager(); dwm.initialize( m_engine, TestEngine.getTestProperties() ); - dwm.unserializeFromDisk( new File( "./target/test-classes", DefaultWorkflowManager.SERIALIZATION_FILE ) ); + dwm.unserializeFromDisk( new File( "./src/test/resources", DefaultWorkflowManager.SERIALIZATION_FILE ) ); Assertions.assertEquals( 1, dwm.m_workflows.size() ); Assertions.assertEquals( 1, dwm.m_queue.decisions().length ); Assertions.assertEquals( 0, dwm.m_completed.size() );