[Git][java-team/jmock2][master] 9 commits: Standards-Version updated to 4.2.1

Emmanuel Bourg gitlab at salsa.debian.org
Thu Sep 20 16:34:56 BST 2018


Emmanuel Bourg pushed to branch master at Debian Java Maintainers / jmock2


Commits:
eff26631 by Emmanuel Bourg at 2018-09-20T14:43:06Z
Standards-Version updated to 4.2.1

- - - - -
839afc87 by Emmanuel Bourg at 2018-09-20T14:43:20Z
Switch to debhelper level 11

- - - - -
136ae159 by Emmanuel Bourg at 2018-09-20T14:43:25Z
Use salsa.debian.org Vcs-* URLs

- - - - -
b347bb13 by Emmanuel Bourg at 2018-09-20T15:16:56Z
Fixed the test failure with Java 10 (Closes: #906370)

- - - - -
2198cb53 by Emmanuel Bourg at 2018-09-20T15:17:51Z
New upstream version 2.8.4
- - - - -
167a1563 by Emmanuel Bourg at 2018-09-20T15:17:52Z
Update upstream source from tag 'upstream/2.8.4'

Update to upstream version '2.8.4'
with Debian dir 798f06f8657baa3797da8a86d26b94a3843e1f44
- - - - -
cea43092 by Emmanuel Bourg at 2018-09-20T15:19:25Z
Refreshed the patches

- - - - -
bf385ee5 by Emmanuel Bourg at 2018-09-20T15:30:35Z
Ignore versions-maven-plugin

- - - - -
fa132cb7 by Emmanuel Bourg at 2018-09-20T15:30:49Z
Upload to unstable

- - - - -


24 changed files:

- .travis.yml
- LICENSE.txt
- README.DEVELOPMENT
- debian/changelog
- debian/compat
- debian/control
- debian/maven.ignoreRules
- debian/patches/01-fix-expectations-creator.patch
- debian/patches/02-ignore-failing-tests.patch
- + debian/patches/03-jaxws-dependency.patch
- debian/patches/series
- debian/rules
- jmock-example/pom.xml
- jmock-junit3/pom.xml
- jmock-junit4/pom.xml
- jmock-legacy/pom.xml
- jmock/pom.xml
- jmock/src/main/java/org/jmock/Mockery.java
- jmock/src/main/java/org/jmock/api/ThreadingPolicy.java
- jmock/src/main/java/org/jmock/internal/InvocationDispatcher.java
- jmock/src/main/java/org/jmock/lib/concurrent/Synchroniser.java
- jmock/src/test/java/org/jmock/test/unit/internal/InvocationDispatcherTests.java
- pom.xml
- testjar/pom.xml


Changes:

=====================================
.travis.yml
=====================================
@@ -2,8 +2,8 @@ language: java
 
 jdk:
   - oraclejdk8
-  - oraclejdk7
-  - openjdk6
+  - openjdk7 #oracle not supported anymore 
+  # openjdk6 not supported any more
 
 env:
 # Travis has slow VMs?


=====================================
LICENSE.txt
=====================================
@@ -1,4 +1,4 @@
-Copyright (c) 2000-2016, jMock.org
+Copyright (c) 2000-2017, jMock.org
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without


=====================================
README.DEVELOPMENT
=====================================
@@ -37,3 +37,12 @@ Throw some kind of RuntimeException to report programming errors in the
 use of the framework.  E.g. trying to set up an expectation to return a 
 result of the wrong type.
 
+Release
+=======
+mvn versions:set -DoldVersion=2.8.1-SNAPSHOT -DnewVersion=2.8.1 -DgroupId=org.jmock
+find . -name pom.xml.versionsBackup -exec rm {} \;
+
+eval $(gpg-agent --daemon --no-grab --write-env-file $HOME/.gpg-agent-info)
+export GPG_AGENT_INFO
+export GPG_TTY=$(tty)
+mvn clean deploy -P release --settings settings.xml -Dgpg.keyname=XXXXXXXX


=====================================
debian/changelog
=====================================
@@ -1,3 +1,15 @@
+jmock2 (2.8.4-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream release
+    - Refreshed the patches
+  * Fixed the test failure with Java 10 (Closes: #906370)
+  * Standards-Version updated to 4.2.1
+  * Switch to debhelper level 11
+  * Use salsa.debian.org Vcs-* URLs
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Thu, 20 Sep 2018 17:30:45 +0200
+
 jmock2 (2.8.3-2) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/compat
=====================================
@@ -1 +1 @@
-10
+11


=====================================
debian/control
=====================================
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: Stephen Nelson <stephen at eccostudio.com>
 Build-Depends:
- debhelper (>= 10),
+ debhelper (>= 11),
  maven-debian-helper (>= 2.0)
 Build-Depends-Indep:
  bsh,
@@ -14,13 +14,14 @@ Build-Depends-Indep:
  libasm-java (>= 5.0),
  libcglib-java (>= 3.0),
  libhamcrest-java (>= 1.3),
+ libjaxws-api-java,
  libmaven-dependency-plugin-java,
  libmaven-exec-plugin-java,
  libmaven-javadoc-plugin-java,
  libobjenesis-java
-Standards-Version: 4.0.0
-Vcs-Git: https://anonscm.debian.org/git/pkg-java/jmock2.git
-Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/jmock2.git
+Standards-Version: 4.2.1
+Vcs-Git: https://salsa.debian.org/java-team/jmock2.git
+Vcs-Browser: https://salsa.debian.org/java-team/jmock2
 Homepage: http://www.jmock.org/
 
 Package: libjmock2-java


=====================================
debian/maven.ignoreRules
=====================================
@@ -1,3 +1,4 @@
 
 org.apache.maven.plugins maven-gpg-plugin * * * *
+org.codehaus.mojo versions-maven-plugin * * * *
 org.sonatype.plugins nexus-staging-maven-plugin * * * *


=====================================
debian/patches/01-fix-expectations-creator.patch
=====================================
@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg at apache.org>
 Forwarded: not-needed
 --- a/jmock/pom.xml
 +++ b/jmock/pom.xml
-@@ -80,8 +80,11 @@
+@@ -77,8 +77,11 @@
                      <!-- java -cp ~/.m2/repository/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar:~.m2/repository/org/ow2/asm/asm-util/4.1/asm-util-4.1.jar 
                          org.objectweb.asm.util.ASMifier target/classes/org/jmock/Expectations.class 
                          > Xpectations.java -->


=====================================
debian/patches/02-ignore-failing-tests.patch
=====================================
@@ -11,10 +11,3 @@ Forwarded: not-needed
      @Test
      public void mockedTypeFromClassImposteriserThatMakesFinalizePublicDoesntWarnOnFinalize() {
          mockery.setImposteriser(ClassImposteriser.INSTANCE);
-@@ -122,4 +123,4 @@
-             return new String(((ByteArrayOutputStream) out).toByteArray());
-         }
-     }
--}
-\ No newline at end of file
-+}


=====================================
debian/patches/03-jaxws-dependency.patch
=====================================
@@ -0,0 +1,19 @@
+Description: Adds an explicit dependency on JAX-WS since it's no longer provided by the JRE
+Author: Emmanuel Bourg <ebourg at apache.org>
+Bug: https://github.com/jmock-developers/jmock-library/pull/111
+
+--- a/jmock/pom.xml
++++ b/jmock/pom.xml
+@@ -43,6 +43,12 @@
+             <groupId>org.hamcrest</groupId>
+             <artifactId>hamcrest-library</artifactId>
+         </dependency>
++        <dependency>
++            <groupId>javax.xml.ws</groupId>
++            <artifactId>jaxws-api</artifactId>
++            <version>2.3.0</version>
++            <scope>test</scope>
++        </dependency>
+     </dependencies>
+ 
+     <build>


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 01-fix-expectations-creator.patch
 02-ignore-failing-tests.patch
+03-jaxws-dependency.patch


=====================================
debian/rules
=====================================
@@ -2,6 +2,3 @@
 
 %:
 	dh $@
-
-get-orig-source:
-	uscan --download-current-version --force-download --verbose


=====================================
jmock-example/pom.xml
=====================================
@@ -5,14 +5,14 @@
 
 	<groupId>org.jmock</groupId>
 	<artifactId>jmock-example</artifactId>
-	<version>2.8.3</version>
+	<version>2.8.4</version>
 	<packaging>jar</packaging>
 	<name>jMock Examples</name>
 
 	<parent>
 		<groupId>org.jmock</groupId>
 		<artifactId>jmock-parent</artifactId>
-		<version>2.8.3</version>
+		<version>2.8.4</version>
 		<relativePath>../pom.xml</relativePath>
 	</parent>
 


=====================================
jmock-junit3/pom.xml
=====================================
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.jmock</groupId>
         <artifactId>jmock-parent</artifactId>
-        <version>2.8.3</version>
+        <version>2.8.4</version>
     </parent>
 
     <artifactId>jmock-junit3</artifactId>


=====================================
jmock-junit4/pom.xml
=====================================
@@ -8,7 +8,7 @@
     <parent>
         <groupId>org.jmock</groupId>
         <artifactId>jmock-parent</artifactId>
-        <version>2.8.3</version>
+        <version>2.8.4</version>
     </parent>
 
     <properties>


=====================================
jmock-legacy/pom.xml
=====================================
@@ -8,7 +8,7 @@
     <parent>
         <groupId>org.jmock</groupId>
         <artifactId>jmock-parent</artifactId>
-        <version>2.8.3</version>
+        <version>2.8.4</version>
     </parent>
 
     <properties>


=====================================
jmock/pom.xml
=====================================
@@ -9,10 +9,7 @@
     <parent>
         <groupId>org.jmock</groupId>
         <artifactId>jmock-parent</artifactId>
-        <version>2.8.3</version>
-        <!-- mvn versions:set -DoldVersion=2.8.1-SNAPSHOT -DnewVersion=2.8.1 
-            -DgroupId=org.jmock -->
-            <!-- find . -name pom.xml.versionsBackup -exec rm {} \; -->
+        <version>2.8.4</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 


=====================================
jmock/src/main/java/org/jmock/Mockery.java
=====================================
@@ -13,6 +13,7 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 
 /**
@@ -24,6 +25,7 @@ import java.util.Set;
  * 
  * @author npryce
  * @author smgf
+ * @author olibye
  * @author named by Ivan Moore.
  */
 public class Mockery implements SelfDescribing {
@@ -35,7 +37,7 @@ public class Mockery implements SelfDescribing {
     private final Set<String> mockNames = new HashSet<String>();
     private final ReturnDefaultValueAction defaultAction = new ReturnDefaultValueAction(imposteriser);
     private final List<Invocation> actualInvocations = new ArrayList<Invocation>();
-    private final InvocationDispatcher dispatcher = new InvocationDispatcher();
+    private final InvocationDispatcher dispatcher = new InvocationDispatcher(new CopyOnWriteArrayList(), new CopyOnWriteArrayList());
 
     private Error firstError = null;
 


=====================================
jmock/src/main/java/org/jmock/api/ThreadingPolicy.java
=====================================
@@ -1,5 +1,7 @@
 package org.jmock.api;
 
+import org.jmock.internal.InvocationDispatcher;
+
 public interface ThreadingPolicy {
     Invokable synchroniseAccessTo(Invokable mockObject);
 }


=====================================
jmock/src/main/java/org/jmock/internal/InvocationDispatcher.java
=====================================
@@ -1,29 +1,39 @@
 package org.jmock.internal;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
 import org.hamcrest.Description;
 import org.hamcrest.SelfDescribing;
 import org.jmock.api.Expectation;
 import org.jmock.api.ExpectationError;
 import org.jmock.api.Invocation;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 public class InvocationDispatcher implements ExpectationCollector, SelfDescribing {
-	private List<Expectation> expectations = new ArrayList<Expectation>();
-	private List<StateMachine> stateMachines = new ArrayList<StateMachine>();
-    
+    private final Collection<Expectation> expectations;
+    private final Collection<StateMachine> stateMachines;
+
+    public InvocationDispatcher() {
+        expectations = new ArrayList<Expectation>();
+        stateMachines = new ArrayList<StateMachine>();
+    }
+
+    public InvocationDispatcher(Collection<Expectation> theExpectations, Collection<StateMachine> theStateMachines) {
+        expectations = theExpectations;
+        stateMachines = theStateMachines;
+    }
+
     public StateMachine newStateMachine(String name) {
         StateMachine stateMachine = new StateMachine(name);
         stateMachines.add(stateMachine);
         return stateMachine;
     }
-    
-	public void add(Expectation expectation) {
-		expectations.add(expectation);
-	}
-	
+
+    public void add(Expectation expectation) {
+        expectations.add(expectation);
+    }
+
     public void describeTo(Description description) {
         describe(description, expectations);
     }
@@ -32,12 +42,15 @@ public class InvocationDispatcher implements ExpectationCollector, SelfDescribin
         describe(description, describedWith(expectations, invocation));
     }
 
-    private Iterable<SelfDescribing> describedWith(List<Expectation> expectations, final Invocation invocation) {
+    private Iterable<SelfDescribing> describedWith(Iterable<Expectation> expectations, final Invocation invocation) {
         final Iterator<Expectation> iterator = expectations.iterator();
         return new Iterable<SelfDescribing>() {
             public Iterator<SelfDescribing> iterator() {
                 return new Iterator<SelfDescribing>() {
-                    public boolean hasNext() { return iterator.hasNext(); }
+                    public boolean hasNext() {
+                        return iterator.hasNext();
+                    }
+
                     public SelfDescribing next() {
                         return new SelfDescribing() {
                             public void describeTo(Description description) {
@@ -45,7 +58,10 @@ public class InvocationDispatcher implements ExpectationCollector, SelfDescribin
                             }
                         };
                     }
-                    public void remove() { iterator.remove(); }
+
+                    public void remove() {
+                        iterator.remove();
+                    }
                 };
             }
         };
@@ -53,36 +69,34 @@ public class InvocationDispatcher implements ExpectationCollector, SelfDescribin
 
     private void describe(Description description, Iterable<? extends SelfDescribing> selfDescribingExpectations) {
         if (expectations.isEmpty()) {
-            description.appendText("no expectations specified: did you...\n"+
-                                   " - forget to start an expectation with a cardinality clause?\n" +
-                                   " - call a mocked method to specify the parameter of an expectation?");
-        }
-        else {
+            description.appendText("no expectations specified: did you...\n" +
+                    " - forget to start an expectation with a cardinality clause?\n" +
+                    " - call a mocked method to specify the parameter of an expectation?");
+        } else {
             description.appendList("expectations:\n  ", "\n  ", "", selfDescribingExpectations);
             if (!stateMachines.isEmpty()) {
                 description.appendList("\nstates:\n  ", "\n  ", "", stateMachines);
             }
         }
     }
-    
 
     public boolean isSatisfied() {
-		for (Expectation expectation : expectations) {
-		    if (! expectation.isSatisfied()) {
+        for (Expectation expectation : expectations) {
+            if (!expectation.isSatisfied()) {
                 return false;
             }
         }
         return true;
-	}
-	
-	public Object dispatch(Invocation invocation) throws Throwable {
-		for (Expectation expectation : expectations) {
-		    if (expectation.matches(invocation)) {
-		        return expectation.invoke(invocation);
+    }
+
+    public Object dispatch(Invocation invocation) throws Throwable {
+        for (Expectation expectation : expectations) {
+            if (expectation.matches(invocation)) {
+                return expectation.invoke(invocation);
             }
         }
-        
+
         throw ExpectationError.unexpected("unexpected invocation", invocation);
-	}
+    }
 
 }


=====================================
jmock/src/main/java/org/jmock/lib/concurrent/Synchroniser.java
=====================================
@@ -2,11 +2,13 @@ package org.jmock.lib.concurrent;
 
 import static org.hamcrest.StringDescription.asString;
 
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.TimeoutException;
 
 import org.jmock.api.Invocation;
 import org.jmock.api.Invokable;
 import org.jmock.api.ThreadingPolicy;
+import org.jmock.internal.InvocationDispatcher;
 import org.jmock.internal.StatePredicate;
 import org.jmock.lib.concurrent.internal.FixedTimeout;
 import org.jmock.lib.concurrent.internal.InfiniteTimeout;
@@ -19,6 +21,7 @@ import org.junit.Assert;
  * helps tests synchronise with background threads.
  * 
  * @author Nat Pryce
+ * @author olibye
  */
 public class Synchroniser implements ThreadingPolicy {
     private final Object sync = new Object();


=====================================
jmock/src/test/java/org/jmock/test/unit/internal/InvocationDispatcherTests.java
=====================================
@@ -1,61 +1,77 @@
 package org.jmock.test.unit.internal;
 
-import junit.framework.TestCase;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
+import org.jmock.api.Expectation;
 import org.jmock.api.ExpectationError;
 import org.jmock.api.Invocation;
 import org.jmock.internal.InvocationDispatcher;
+import org.jmock.internal.StateMachine;
 import org.jmock.test.unit.support.MethodFactory;
 import org.jmock.test.unit.support.MockExpectation;
 
+import junit.framework.TestCase;
+
 public class InvocationDispatcherTests extends TestCase {
-	MethodFactory methodFactory = new MethodFactory();
-	Invocation invocation = new Invocation(
-	    "invokedObject", 
-		methodFactory.newMethod("invokedMethod"),
-		Invocation.NO_PARAMETERS);
-	
-	static final boolean NOT_RELEVANT = true;
-	
+    
+    // Avoid multi threaeding tests deadlocking
+    // Adjust timeout for debugging
+    private static final TimeUnit TIMEOUT_UNIT = TimeUnit.SECONDS;
+    private static final int TIMEOUT = 2;
+    
+    MethodFactory methodFactory = new MethodFactory();
+    Invocation invocation = new Invocation(
+            "invokedObject",
+            methodFactory.newMethod("invokedMethod"),
+            Invocation.NO_PARAMETERS);
+
+    static final boolean NOT_RELEVANT = true;
+
     public void testInvokesFirstMatchingExpectationInGroup() throws Throwable {
         MockExpectation expectation1 = new MockExpectation(false, NOT_RELEVANT, NOT_RELEVANT);
         MockExpectation expectation2 = new MockExpectation(true, NOT_RELEVANT, NOT_RELEVANT);
         MockExpectation expectation3 = new MockExpectation(true, NOT_RELEVANT, NOT_RELEVANT);
-        
+
         InvocationDispatcher dispatcher = new InvocationDispatcher();
         dispatcher.add(expectation1);
         dispatcher.add(expectation2);
         dispatcher.add(expectation3);
-        
+
         expectation1.shouldNotBeInvoked();
         expectation2.shouldBeInvokedWith(invocation);
         expectation3.shouldNotBeInvoked();
-        
+
         dispatcher.dispatch(invocation);
-        
-        assertTrue("expectation2 should have been invoked", 
-                   expectation2.wasInvoked);
+
+        assertTrue("expectation2 should have been invoked",
+                expectation2.wasInvoked);
     }
 
     public void testThrowsExpectationErrorIfNoExpectationsMatchAnInvocation() throws Throwable {
         MockExpectation expectation1 = new MockExpectation(false, NOT_RELEVANT, NOT_RELEVANT);
         MockExpectation expectation2 = new MockExpectation(false, NOT_RELEVANT, NOT_RELEVANT);
         MockExpectation expectation3 = new MockExpectation(false, NOT_RELEVANT, NOT_RELEVANT);
-        
+
         InvocationDispatcher dispatcher = new InvocationDispatcher();
         dispatcher.add(expectation1);
         dispatcher.add(expectation2);
         dispatcher.add(expectation3);
-        
+
         expectation1.shouldNotBeInvoked();
         expectation2.shouldNotBeInvoked();
         expectation3.shouldNotBeInvoked();
-        
+
         try {
             dispatcher.dispatch(invocation);
             fail("should have thrown ExpectationError");
-        }
-        catch (ExpectationError e) {
+        } catch (ExpectationError e) {
             // expected
         }
     }
@@ -65,24 +81,166 @@ public class InvocationDispatcherTests extends TestCase {
         dispatcherAll.add(new MockExpectation(NOT_RELEVANT, true, NOT_RELEVANT));
         dispatcherAll.add(new MockExpectation(NOT_RELEVANT, true, NOT_RELEVANT));
         assertTrue("should be satisfied if all expectations are satisfied",
-                   dispatcherAll.isSatisfied());
-        
+                dispatcherAll.isSatisfied());
+
         InvocationDispatcher dispatcher1 = new InvocationDispatcher();
         dispatcher1.add(new MockExpectation(NOT_RELEVANT, true, NOT_RELEVANT));
         dispatcher1.add(new MockExpectation(NOT_RELEVANT, false, NOT_RELEVANT));
         assertFalse("should not be satisfied if first expectation is not satisfied",
-                   dispatcher1.isSatisfied());
-        
+                dispatcher1.isSatisfied());
+
         InvocationDispatcher dispatcher2 = new InvocationDispatcher();
         dispatcher2.add(new MockExpectation(NOT_RELEVANT, false, NOT_RELEVANT));
         dispatcher2.add(new MockExpectation(NOT_RELEVANT, true, NOT_RELEVANT));
         assertFalse("should not be satisfied if second expectation is not satisfied",
-                   dispatcher2.isSatisfied());
-        
+                dispatcher2.isSatisfied());
+
         InvocationDispatcher dispatcherNone = new InvocationDispatcher();
         dispatcherNone.add(new MockExpectation(NOT_RELEVANT, false, NOT_RELEVANT));
         dispatcherNone.add(new MockExpectation(NOT_RELEVANT, true, NOT_RELEVANT));
         assertFalse("should not be satisfied if no expectations are satisfied",
-                    dispatcherNone.isSatisfied());
+                dispatcherNone.isSatisfied());
     }
+
+    /**
+     * Resolves issue 104
+     * 
+     * @throws Throwable
+     */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public void testHandlesAddingExpectationsWhileOtherTestsDispatch() throws Throwable {
+
+        final CyclicBarrier barrier = new CyclicBarrier(2);
+
+        MockExpectation expectation1 = new MockExpectation(true, NOT_RELEVANT, NOT_RELEVANT);
+        MockExpectation expectation2 = new MockExpectation(false, NOT_RELEVANT, NOT_RELEVANT);
+
+        CriticalSectionForcingCollectionWrapper<Expectation> expectations = new CriticalSectionForcingCollectionWrapper(
+                new CopyOnWriteArrayList(), barrier);
+        CriticalSectionForcingCollectionWrapper<StateMachine> stateMachines = new CriticalSectionForcingCollectionWrapper(
+                new ArrayList(), barrier);
+        final InvocationDispatcher dispatcher = new InvocationDispatcher(expectations, stateMachines);
+
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    barrier.await(TIMEOUT, TIMEOUT_UNIT);
+                    barrier.await(TIMEOUT, TIMEOUT_UNIT);
+                    // now the expectation one has been added
+                    
+                    dispatcher.dispatch(invocation);
+                    barrier.await(TIMEOUT, TIMEOUT_UNIT);
+                } catch (Throwable e) {
+                    // will throw a ConcurrentModification Exception unless a multithreaded strategy
+                    // is used
+                    throw new RuntimeException(e);
+                }
+            }
+        }, "Concurrent Dispatch").start();
+
+        // expect dispatch
+        dispatcher.add(expectation1);
+        // await is satisfied check
+
+        dispatcher.add(expectation2);
+        barrier.await(TIMEOUT, TIMEOUT_UNIT);
+
+        expectation1.shouldBeInvokedWith(invocation);
+        assertTrue("expectation1 should have been invoked",
+                expectation1.wasInvoked);
+    }
+
+    private class CriticalSectionForcingCollectionWrapper<T> implements Collection<T> {
+        private final Collection<T> delegate;
+        private final CyclicBarrier barrier;
+
+        CriticalSectionForcingCollectionWrapper(Collection<T> delegate, CyclicBarrier barrier) {
+            this.delegate = delegate;
+            this.barrier = barrier;
+        }
+
+        private void await() {
+            try {
+                // we want the expectation check to have got the iterator
+                // but not progressed checking
+                barrier.await(TIMEOUT, TIMEOUT_UNIT);
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            } catch (BrokenBarrierException e) {
+                throw new RuntimeException(e);
+            } catch (TimeoutException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        public int size() {
+            return delegate.size();
+        }
+
+        public boolean isEmpty() {
+            return delegate.isEmpty();
+        }
+
+        public boolean contains(Object o) {
+            return delegate.contains(o);
+        }
+
+        public Iterator<T> iterator() {
+            Iterator<T> reply = delegate.iterator();
+            await(); // expectation add follows this
+            await(); // wait for add to complete
+            return reply;
+        }
+
+        public Object[] toArray() {
+            return delegate.toArray();
+        }
+
+        public <T> T[] toArray(T[] a) {
+            return delegate.toArray(a);
+        }
+
+        public boolean add(T e) {
+            // Make sure iterator is called before adding
+            await();
+            boolean reply = delegate.add(e);
+            // Make sure iterator returns after adding
+            await();
+            return reply;
+        }
+
+        public boolean remove(Object o) {
+            return delegate.remove(o);
+        }
+
+        public boolean containsAll(Collection<?> c) {
+            return delegate.containsAll(c);
+        }
+
+        public boolean addAll(Collection<? extends T> c) {
+            return delegate.addAll(c);
+        }
+
+        public boolean removeAll(Collection<?> c) {
+            return delegate.removeAll(c);
+        }
+
+        public boolean retainAll(Collection<?> c) {
+            return delegate.retainAll(c);
+        }
+
+        public void clear() {
+            delegate.clear();
+        }
+
+        public boolean equals(Object o) {
+            return delegate.equals(o);
+        }
+
+        public int hashCode() {
+            return delegate.hashCode();
+        }
+    }
+
 }


=====================================
pom.xml
=====================================
@@ -1,14 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
     <groupId>org.jmock</groupId>
     <artifactId>jmock-parent</artifactId>
-    <version>2.8.3</version>
+    <version>2.8.4</version>
     <packaging>pom</packaging>
     <name>jMock 2 Parent</name>
 
+    <!-- mvn versions:set -DoldVersion=2.8.3 -DnewVersion=2.8.4-SNAPSHOT -DgroupId=org.jmock -->
+    <!-- find . -name pom.xml.versionsBackup -exec rm {} \; -->
+
     <parent>
         <groupId>org.sonatype.oss</groupId>
         <artifactId>oss-parent</artifactId>
@@ -76,7 +80,7 @@
                     </execution>
                 </executions>
             </plugin>
-            
+
             <plugin>
                 <!-- http://central.sonatype.org/pages/apache-maven.html -->
                 <groupId>org.sonatype.plugins</groupId>
@@ -91,7 +95,7 @@
             </plugin>
 
         </plugins>
-        
+
         <pluginManagement>
             <plugins>
                 <plugin>
@@ -200,6 +204,25 @@
             <url>https://oss.sonatype.org/content/repositories/snapshots</url>
         </snapshotRepository>
     </distributionManagement>
+    
+    <reporting>
+      <plugins>
+        <plugin>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>versions-maven-plugin</artifactId>
+          <version>2.5</version>
+          <reportSets>
+            <reportSet>
+              <reports>
+                <report>dependency-updates-report</report>
+                <report>plugin-updates-report</report>
+                <report>property-updates-report</report>
+              </reports>
+            </reportSet>
+          </reportSets>
+        </plugin>
+      </plugins>
+    </reporting>
 
     <profiles>
         <profile>
@@ -210,9 +233,10 @@
                         <!-- http://central.sonatype.org/pages/apache-maven.html -->
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-gpg-plugin</artifactId>
-                        <version>1.5</version>
+                        <version>1.6</version>
                         <configuration>
                             <useAgent>true</useAgent>
+                            <keyname>${gpg.keyname}</keyname>
                         </configuration>
                         <executions>
                             <execution>


=====================================
testjar/pom.xml
=====================================
@@ -10,7 +10,7 @@
 	<parent>
 		<groupId>org.jmock</groupId>
 		<artifactId>jmock-parent</artifactId>
-		<version>2.8.3</version>
+		<version>2.8.4</version>
 		<relativePath>../pom.xml</relativePath>
 	</parent>
 



View it on GitLab: https://salsa.debian.org/java-team/jmock2/compare/1c1e1ab7c33a8415df5570aa5df8708aa7527d42...fa132cb7f43c65281333fd142490862844caceb9

-- 
View it on GitLab: https://salsa.debian.org/java-team/jmock2/compare/1c1e1ab7c33a8415df5570aa5df8708aa7527d42...fa132cb7f43c65281333fd142490862844caceb9
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20180920/ee9d096a/attachment.html>


More information about the pkg-java-commits mailing list