use of org.mockito.internal.verification.Times in project gocd by gocd.
the class TestArtifactPlanTest method shouldSupportGlobPatternsInSourcePath.
@Test
public void shouldSupportGlobPatternsInSourcePath() {
ArtifactPlan artifactPlan = new ArtifactPlan("**/*/a.log", "logs");
TestArtifactPlan testArtifactPlan = new TestArtifactPlan(artifactPlan);
File first = new File("target/test/report/a.log");
File second = new File("target/test/test/a/b/a.log");
first.mkdirs();
second.mkdirs();
testArtifactPlan.publish(mockArtifactPublisher, rootPath);
verify(mockArtifactPublisher).upload(first, "logs/report");
verify(mockArtifactPublisher).upload(second, "logs/test/a/b");
verify(mockArtifactPublisher, new Times(2)).upload(any(File.class), eq("testoutput"));
}
use of org.mockito.internal.verification.Times in project geode by apache.
the class GMSJoinLeaveJUnitTest method testNetworkPartionMessage.
// With the removal of the JoinResponse message from GMSJoinLeave.processJoinRequest (GEODE-870)
// This test now seems to be invalid
// @Test
// public void testJoinResponseMsgWithBecomeCoordinator() throws Exception {
// initMocks(false);
// gmsJoinLeaveMemberId.getNetMember().setPreferredForCoordinator(false);
// JoinRequestMessage reqMsg = new JoinRequestMessage(gmsJoinLeaveMemberId, mockMembers[0], null,
// 56734);
// InternalDistributedMember ids = new InternalDistributedMember("localhost", 97898);
// ids.getNetMember().setPreferredForCoordinator(true);
// gmsJoinLeave.processMessage(reqMsg);
// ArgumentCaptor<JoinResponseMessage> ac = ArgumentCaptor.forClass(JoinResponseMessage.class);
// verify(messenger).send(ac.capture());
//
// assertTrue("Should have asked for becoming a coordinator",
// ac.getValue().getBecomeCoordinator());
// }
@Test
public void testNetworkPartionMessage() throws Exception {
try {
initMocks(true);
System.setProperty(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY, "true");
gmsJoinLeave.join();
installView(1, gmsJoinLeaveMemberId, createMemberList(mockMembers[0], mockMembers[1], mockMembers[2], gmsJoinLeaveMemberId, mockMembers[3]));
for (int i = 1; i < 4; i++) {
RemoveMemberMessage msg = new RemoveMemberMessage(gmsJoinLeaveMemberId, mockMembers[i], "crashed");
msg.setSender(gmsJoinLeaveMemberId);
gmsJoinLeave.processMessage(msg);
}
Timeout to = new Timeout(3 * ServiceConfig.MEMBER_REQUEST_COLLECTION_INTERVAL, new Times(1));
verify(messenger, to).send(isA(NetworkPartitionMessage.class));
} finally {
System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
}
}
Aggregations