-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45179f8
commit 651e20b
Showing
3 changed files
with
51 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 0 additions & 48 deletions
48
...st/groovy/com/hltech/contracts/judged/agent/config/CachingDelegatingDPublisherTest.groovy
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
...test/groovy/com/hltech/contracts/judged/agent/config/CachingDelegatingDPublisherUT.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.hltech.contracts.judged.agent.config | ||
|
||
import com.hltech.contracts.judged.agent.JudgeDPublisher | ||
import spock.lang.Specification | ||
|
||
class CachingDelegatingDPublisherUT extends Specification { | ||
|
||
private CachingDelegatingDPublisher publisher | ||
private JudgeDPublisher targetPublisher | ||
|
||
def setup() { | ||
targetPublisher = Mock(JudgeDPublisher) | ||
publisher = new CachingDelegatingDPublisher(targetPublisher) | ||
} | ||
|
||
def "should delegate to target publisher when publish for the first time"() { | ||
given: | ||
def forms = [new JudgeDPublisher.ServiceForm("name", "version")] as Set | ||
when: | ||
publisher.publish("SIT", forms) | ||
then: | ||
1 * targetPublisher.publish("SIT", forms) | ||
} | ||
|
||
def "should delegate to target publisher once when subsequently publish the same set of service multiple times "() { | ||
given: | ||
def forms = [new JudgeDPublisher.ServiceForm("name", "version")] as Set | ||
when: | ||
publisher.publish("SIT", forms) | ||
publisher.publish("SIT", forms) | ||
publisher.publish("SIT", forms) | ||
then: | ||
1 * targetPublisher.publish("SIT", forms) | ||
} | ||
|
||
def 'should delegate to target publisher when subsequently publish different set of services'() { | ||
given: | ||
def forms1 = [new JudgeDPublisher.ServiceForm("name1", "version")] as Set | ||
def forms2 = [new JudgeDPublisher.ServiceForm("name2", "version")] as Set | ||
when: | ||
publisher.publish("SIT", forms1) | ||
publisher.publish("SIT", forms2) | ||
then: | ||
1 * targetPublisher.publish("SIT", forms1) | ||
then: | ||
1 * targetPublisher.publish("SIT", forms2) | ||
} | ||
} |