HADOOP-18860. Upgrade mockito version to 4.11.0 (#5977)
As well as the POM update, this patch moves to the (renamed) verify methods. Backporting mockito test changes may now require cherrypicking this patch, otherwise use the old method names. Contributed by Anmol Asrani
This commit is contained in:
parent
39eaf8d14e
commit
1046f9cf98
@ -151,7 +151,7 @@ public Writable call(
|
|||||||
|
|
||||||
// Nothing should be logged for a suppressed exception.
|
// Nothing should be logged for a suppressed exception.
|
||||||
server.logException(logger, new TestException1(), dummyCall);
|
server.logException(logger, new TestException1(), dummyCall);
|
||||||
verifyZeroInteractions(logger);
|
verifyNoInteractions(logger);
|
||||||
|
|
||||||
// No stack trace should be logged for a terse exception.
|
// No stack trace should be logged for a terse exception.
|
||||||
server.logException(logger, new TestException2(), dummyCall);
|
server.logException(logger, new TestException2(), dummyCall);
|
||||||
|
@ -58,8 +58,7 @@ public void testSameOrigin() throws ServletException, IOException {
|
|||||||
CrossOriginFilter filter = new CrossOriginFilter();
|
CrossOriginFilter filter = new CrossOriginFilter();
|
||||||
filter.init(filterConfig);
|
filter.init(filterConfig);
|
||||||
filter.doFilter(mockReq, mockRes, mockChain);
|
filter.doFilter(mockReq, mockRes, mockChain);
|
||||||
|
Mockito.verifyNoInteractions(mockRes);
|
||||||
Mockito.verifyZeroInteractions(mockRes);
|
|
||||||
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +223,7 @@ public void testDisallowedOrigin() throws ServletException, IOException {
|
|||||||
filter.init(filterConfig);
|
filter.init(filterConfig);
|
||||||
filter.doFilter(mockReq, mockRes, mockChain);
|
filter.doFilter(mockReq, mockRes, mockChain);
|
||||||
|
|
||||||
Mockito.verifyZeroInteractions(mockRes);
|
Mockito.verifyNoInteractions(mockRes);
|
||||||
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +251,7 @@ public void testDisallowedMethod() throws ServletException, IOException {
|
|||||||
filter.init(filterConfig);
|
filter.init(filterConfig);
|
||||||
filter.doFilter(mockReq, mockRes, mockChain);
|
filter.doFilter(mockReq, mockRes, mockChain);
|
||||||
|
|
||||||
Mockito.verifyZeroInteractions(mockRes);
|
Mockito.verifyNoInteractions(mockRes);
|
||||||
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +282,7 @@ public void testDisallowedHeader() throws ServletException, IOException {
|
|||||||
filter.init(filterConfig);
|
filter.init(filterConfig);
|
||||||
filter.doFilter(mockReq, mockRes, mockChain);
|
filter.doFilter(mockReq, mockRes, mockChain);
|
||||||
|
|
||||||
Mockito.verifyZeroInteractions(mockRes);
|
Mockito.verifyNoInteractions(mockRes);
|
||||||
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
Mockito.verify(mockChain).doFilter(mockReq, mockRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public void testNoHeaderDefaultConfigBadRequest()
|
|||||||
|
|
||||||
verify(mockRes, atLeastOnce()).sendError(
|
verify(mockRes, atLeastOnce()).sendError(
|
||||||
HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE);
|
HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE);
|
||||||
Mockito.verifyZeroInteractions(mockChain);
|
Mockito.verifyNoInteractions(mockChain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -110,7 +110,7 @@ public void testNoHeaderCustomAgentConfigBadRequest()
|
|||||||
|
|
||||||
verify(mockRes, atLeastOnce()).sendError(
|
verify(mockRes, atLeastOnce()).sendError(
|
||||||
HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE);
|
HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE);
|
||||||
Mockito.verifyZeroInteractions(mockChain);
|
Mockito.verifyNoInteractions(mockChain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -228,7 +228,7 @@ public void testMissingHeaderWithCustomHeaderConfigBadRequest()
|
|||||||
filter.init(filterConfig);
|
filter.init(filterConfig);
|
||||||
filter.doFilter(mockReq, mockRes, mockChain);
|
filter.doFilter(mockReq, mockRes, mockChain);
|
||||||
|
|
||||||
Mockito.verifyZeroInteractions(mockChain);
|
Mockito.verifyNoInteractions(mockChain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -260,7 +260,7 @@ public void testMissingHeaderNoMethodsToIgnoreConfigBadRequest()
|
|||||||
filter.init(filterConfig);
|
filter.init(filterConfig);
|
||||||
filter.doFilter(mockReq, mockRes, mockChain);
|
filter.doFilter(mockReq, mockRes, mockChain);
|
||||||
|
|
||||||
Mockito.verifyZeroInteractions(mockChain);
|
Mockito.verifyNoInteractions(mockChain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -356,6 +356,6 @@ public void testMissingHeaderMultipleIgnoreMethodsConfigBadRequest()
|
|||||||
filter.init(filterConfig);
|
filter.init(filterConfig);
|
||||||
filter.doFilter(mockReq, mockRes, mockChain);
|
filter.doFilter(mockReq, mockRes, mockChain);
|
||||||
|
|
||||||
Mockito.verifyZeroInteractions(mockChain);
|
Mockito.verifyNoInteractions(mockChain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.security.PrivilegedExceptionAction;
|
import java.security.PrivilegedExceptionAction;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -68,7 +69,6 @@
|
|||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.internal.util.reflection.FieldSetter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The administrator interface of the {@link Router} implemented by
|
* The administrator interface of the {@link Router} implemented by
|
||||||
@ -118,18 +118,20 @@ public static void globalSetUp() throws Exception {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws NoSuchFieldException
|
* @throws NoSuchFieldException
|
||||||
*/
|
*/
|
||||||
private static void setUpMocks() throws IOException, NoSuchFieldException {
|
private static void setUpMocks() throws IOException, NoSuchFieldException,
|
||||||
|
IllegalAccessException {
|
||||||
RouterRpcServer spyRpcServer =
|
RouterRpcServer spyRpcServer =
|
||||||
Mockito.spy(routerContext.getRouter().createRpcServer());
|
Mockito.spy(routerContext.getRouter().createRpcServer());
|
||||||
FieldSetter.setField(routerContext.getRouter(),
|
Field rpcServerField = Router.class.getDeclaredField("rpcServer");
|
||||||
Router.class.getDeclaredField("rpcServer"), spyRpcServer);
|
rpcServerField.setAccessible(true);
|
||||||
|
rpcServerField.set(routerContext.getRouter(), spyRpcServer);
|
||||||
Mockito.doReturn(null).when(spyRpcServer).getFileInfo(Mockito.anyString());
|
Mockito.doReturn(null).when(spyRpcServer).getFileInfo(Mockito.anyString());
|
||||||
|
|
||||||
// mock rpc client for destination check when editing mount tables.
|
// mock rpc client for destination check when editing mount tables.
|
||||||
mockRpcClient = Mockito.spy(spyRpcServer.getRPCClient());
|
mockRpcClient = Mockito.spy(spyRpcServer.getRPCClient());
|
||||||
FieldSetter.setField(spyRpcServer,
|
Field rpcClientField = RouterRpcServer.class.getDeclaredField("rpcClient");
|
||||||
RouterRpcServer.class.getDeclaredField("rpcClient"),
|
rpcClientField.setAccessible(true);
|
||||||
mockRpcClient);
|
rpcClientField.set(spyRpcServer, mockRpcClient);
|
||||||
RemoteLocation remoteLocation0 =
|
RemoteLocation remoteLocation0 =
|
||||||
new RemoteLocation("ns0", "/testdir", null);
|
new RemoteLocation("ns0", "/testdir", null);
|
||||||
RemoteLocation remoteLocation1 =
|
RemoteLocation remoteLocation1 =
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Mockito.doThrow;
|
import static org.mockito.Mockito.doThrow;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.apache.hadoop.test.Whitebox.getInternalState;
|
import static org.apache.hadoop.test.Whitebox.getInternalState;
|
||||||
|
@ -1575,7 +1575,7 @@ public void testNoLookupsWhenNotUsed() throws Exception {
|
|||||||
CacheManager cm = cluster.getNamesystem().getCacheManager();
|
CacheManager cm = cluster.getNamesystem().getCacheManager();
|
||||||
LocatedBlocks locations = Mockito.mock(LocatedBlocks.class);
|
LocatedBlocks locations = Mockito.mock(LocatedBlocks.class);
|
||||||
cm.setCachedLocations(locations);
|
cm.setCachedLocations(locations);
|
||||||
Mockito.verifyZeroInteractions(locations);
|
Mockito.verifyNoInteractions(locations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout=120000)
|
@Test(timeout=120000)
|
||||||
|
@ -447,6 +447,6 @@ public void testShortCircuitSnapshotSearch() throws SnapshotException {
|
|||||||
INodesInPath iip = Mockito.mock(INodesInPath.class);
|
INodesInPath iip = Mockito.mock(INodesInPath.class);
|
||||||
List<INodeDirectory> snapDirs = new ArrayList<>();
|
List<INodeDirectory> snapDirs = new ArrayList<>();
|
||||||
FSDirSnapshotOp.checkSnapshot(fsn.getFSDirectory(), iip, snapDirs);
|
FSDirSnapshotOp.checkSnapshot(fsn.getFSDirectory(), iip, snapDirs);
|
||||||
Mockito.verifyZeroInteractions(iip);
|
Mockito.verifyNoInteractions(iip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,9 @@
|
|||||||
<!-- com.google.re2j version -->
|
<!-- com.google.re2j version -->
|
||||||
<re2j.version>1.1</re2j.version>
|
<re2j.version>1.1</re2j.version>
|
||||||
|
|
||||||
|
<!-- org.mockito.mockito-core version -->
|
||||||
|
<mockito.version>4.11.0</mockito.version>
|
||||||
|
|
||||||
<!--Protobuf version for backward compatibility-->
|
<!--Protobuf version for backward compatibility-->
|
||||||
<protobuf.version>2.5.0</protobuf.version>
|
<protobuf.version>2.5.0</protobuf.version>
|
||||||
<!-- ProtocolBuffer version, actually used in Hadoop -->
|
<!-- ProtocolBuffer version, actually used in Hadoop -->
|
||||||
@ -1303,7 +1306,20 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>2.28.2</version>
|
<version>${mockito.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-inline</artifactId>
|
||||||
|
<version>${mockito.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.reset;
|
import static org.mockito.Mockito.reset;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,7 +90,7 @@ public void testContainerRetries() throws Exception {
|
|||||||
|
|
||||||
providerService.buildContainerRetry(mockLauncher, getConfig(),
|
providerService.buildContainerRetry(mockLauncher, getConfig(),
|
||||||
componentLaunchContext, componentInstance);
|
componentLaunchContext, componentInstance);
|
||||||
verifyZeroInteractions(mockLauncher);
|
verifyNoInteractions(mockLauncher);
|
||||||
|
|
||||||
|
|
||||||
//OnFailure restart policy
|
//OnFailure restart policy
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the CGroups handler implementation.
|
* Tests for the CGroups handler implementation.
|
||||||
@ -192,7 +192,7 @@ public void testMountController() throws IOException {
|
|||||||
assertTrue("cgroup dir should be cerated", cgroup.mkdirs());
|
assertTrue("cgroup dir should be cerated", cgroup.mkdirs());
|
||||||
//Since we enabled (deferred) cgroup controller mounting, no interactions
|
//Since we enabled (deferred) cgroup controller mounting, no interactions
|
||||||
//should have occurred, with this mock
|
//should have occurred, with this mock
|
||||||
verifyZeroInteractions(privilegedOperationExecutorMock);
|
verifyNoInteractions(privilegedOperationExecutorMock);
|
||||||
File emptyMtab = createEmptyCgroups();
|
File emptyMtab = createEmptyCgroups();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -238,7 +238,7 @@ public void testMountController() throws IOException {
|
|||||||
public void testCGroupPaths() throws IOException {
|
public void testCGroupPaths() throws IOException {
|
||||||
//As per junit behavior, we expect a new mock object to be available
|
//As per junit behavior, we expect a new mock object to be available
|
||||||
//in this test.
|
//in this test.
|
||||||
verifyZeroInteractions(privilegedOperationExecutorMock);
|
verifyNoInteractions(privilegedOperationExecutorMock);
|
||||||
CGroupsHandler cGroupsHandler = null;
|
CGroupsHandler cGroupsHandler = null;
|
||||||
File mtab = createEmptyCgroups();
|
File mtab = createEmptyCgroups();
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ public void testCGroupPaths() throws IOException {
|
|||||||
public void testCGroupOperations() throws IOException {
|
public void testCGroupOperations() throws IOException {
|
||||||
//As per junit behavior, we expect a new mock object to be available
|
//As per junit behavior, we expect a new mock object to be available
|
||||||
//in this test.
|
//in this test.
|
||||||
verifyZeroInteractions(privilegedOperationExecutorMock);
|
verifyNoInteractions(privilegedOperationExecutorMock);
|
||||||
CGroupsHandler cGroupsHandler = null;
|
CGroupsHandler cGroupsHandler = null;
|
||||||
File mtab = createEmptyCgroups();
|
File mtab = createEmptyCgroups();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
import static org.mockito.Mockito.doThrow;
|
import static org.mockito.Mockito.doThrow;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -210,7 +210,7 @@ private void assertAllocatedGpus(int gpus, int deniedGpus,
|
|||||||
private void assertNoAllocation(GpuAllocation allocation) {
|
private void assertNoAllocation(GpuAllocation allocation) {
|
||||||
assertEquals(1, allocation.getDeniedGPUs().size());
|
assertEquals(1, allocation.getDeniedGPUs().size());
|
||||||
assertEquals(0, allocation.getAllowedGPUs().size());
|
assertEquals(0, allocation.getAllowedGPUs().size());
|
||||||
verifyZeroInteractions(nmStateStore);
|
verifyNoInteractions(nmStateStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertAssignmentInStateStore(GpuDevice expectedGpu,
|
private void assertAssignmentInStateStore(GpuDevice expectedGpu,
|
||||||
|
@ -1272,7 +1272,7 @@ public void testCGroupParent() throws ContainerExecutionException {
|
|||||||
command);
|
command);
|
||||||
|
|
||||||
//no --cgroup-parent should be added here
|
//no --cgroup-parent should be added here
|
||||||
Mockito.verifyZeroInteractions(command);
|
Mockito.verifyNoMoreInteractions(command);
|
||||||
|
|
||||||
String resourceOptionsCpu = "/sys/fs/cgroup/cpu/" + hierarchy +
|
String resourceOptionsCpu = "/sys/fs/cgroup/cpu/" + hierarchy +
|
||||||
containerIdStr;
|
containerIdStr;
|
||||||
@ -1296,7 +1296,7 @@ public void testCGroupParent() throws ContainerExecutionException {
|
|||||||
command);
|
command);
|
||||||
|
|
||||||
//no --cgroup-parent should be added in either case
|
//no --cgroup-parent should be added in either case
|
||||||
Mockito.verifyZeroInteractions(command);
|
Mockito.verifyNoMoreInteractions(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
@ -394,7 +394,7 @@ public void testFindDevicesWithUdev()
|
|||||||
assertEquals("No. of devices", 1, devices.size());
|
assertEquals("No. of devices", 1, devices.size());
|
||||||
Device device = devices.iterator().next();
|
Device device = devices.iterator().next();
|
||||||
assertSame("Device", device, testDevice);
|
assertSame("Device", device, testDevice);
|
||||||
verifyZeroInteractions(mockCommandExecutor);
|
verifyNoInteractions(mockCommandExecutor);
|
||||||
verify(mockEnvProvider).apply(eq("NEC_USE_UDEV"));
|
verify(mockEnvProvider).apply(eq("NEC_USE_UDEV"));
|
||||||
verifyNoMoreInteractions(mockEnvProvider);
|
verifyNoMoreInteractions(mockEnvProvider);
|
||||||
}
|
}
|
||||||
@ -442,6 +442,6 @@ private Device getTestDevice(int id) {
|
|||||||
private void verifyBinaryPathSet(Path expectedPath) {
|
private void verifyBinaryPathSet(Path expectedPath) {
|
||||||
assertEquals("Binary path", expectedPath.toString(),
|
assertEquals("Binary path", expectedPath.toString(),
|
||||||
plugin.getBinaryPath());
|
plugin.getBinaryPath());
|
||||||
verifyZeroInteractions(udevUtil);
|
verifyNoInteractions(udevUtil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doThrow;
|
import static org.mockito.Mockito.doThrow;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -666,7 +666,7 @@ public void testValidationSkippedWhenCmdLineSwitchIsDefined()
|
|||||||
FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s");
|
FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s");
|
||||||
argumentHandler.parseAndConvert(args);
|
argumentHandler.parseAndConvert(args);
|
||||||
|
|
||||||
verifyZeroInteractions(mockValidator);
|
verifyNoInteractions(mockValidator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -681,7 +681,7 @@ public void testValidationSkippedWhenOutputIsConsole() throws Exception {
|
|||||||
FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s", "-p");
|
FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s", "-p");
|
||||||
argumentHandler.parseAndConvert(args);
|
argumentHandler.parseAndConvert(args);
|
||||||
|
|
||||||
verifyZeroInteractions(mockValidator);
|
verifyNoInteractions(mockValidator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -673,7 +673,7 @@ public void testPlacementRulesConversionDisabled() throws Exception {
|
|||||||
converter.setPlacementConverter(placementConverter);
|
converter.setPlacementConverter(placementConverter);
|
||||||
converter.convert(params);
|
converter.convert(params);
|
||||||
|
|
||||||
verifyZeroInteractions(placementConverter);
|
verifyNoInteractions(placementConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -85,7 +85,7 @@ public void testConvertUserRule() {
|
|||||||
MappingRulesDescription description = convert();
|
MappingRulesDescription description = convert();
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.USER);
|
verifyRule(description.getRules().get(0), Policy.USER);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -96,7 +96,7 @@ public void testConvertSpecifiedRule() {
|
|||||||
MappingRulesDescription description = convert();
|
MappingRulesDescription description = convert();
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.SPECIFIED);
|
verifyRule(description.getRules().get(0), Policy.SPECIFIED);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -108,7 +108,7 @@ public void testConvertPrimaryGroupRule() {
|
|||||||
|
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP);
|
verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -120,7 +120,7 @@ public void testConvertSecondaryGroupRule() {
|
|||||||
|
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP);
|
verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -134,7 +134,7 @@ public void testConvertDefaultRuleWithQueueName() {
|
|||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
|
|
||||||
verifyRule(description.getRules().get(0), Policy.CUSTOM);
|
verifyRule(description.getRules().get(0), Policy.CUSTOM);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -147,7 +147,7 @@ public void testConvertDefaultRule() {
|
|||||||
|
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.DEFAULT_QUEUE);
|
verifyRule(description.getRules().get(0), Policy.DEFAULT_QUEUE);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@ -168,7 +168,7 @@ public void testConvertRejectRule() {
|
|||||||
|
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.REJECT);
|
verifyRule(description.getRules().get(0), Policy.REJECT);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -182,7 +182,7 @@ public void testConvertNestedPrimaryGroupRule() {
|
|||||||
|
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP_USER);
|
verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP_USER);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -197,7 +197,7 @@ public void testConvertNestedSecondaryGroupRule() {
|
|||||||
|
|
||||||
assertEquals("Number of rules", 1, description.getRules().size());
|
assertEquals("Number of rules", 1, description.getRules().size());
|
||||||
verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP_USER);
|
verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP_USER);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -215,7 +215,7 @@ public void testConvertNestedDefaultRule() {
|
|||||||
Rule rule = description.getRules().get(0);
|
Rule rule = description.getRules().get(0);
|
||||||
verifyRule(description.getRules().get(0), Policy.USER);
|
verifyRule(description.getRules().get(0), Policy.USER);
|
||||||
assertEquals("Parent path", "root.abc", rule.getParentQueue());
|
assertEquals("Parent path", "root.abc", rule.getParentQueue());
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@ -245,7 +245,7 @@ public void testConvertMultiplePlacementRules() {
|
|||||||
verifyRule(description.getRules().get(0), Policy.USER);
|
verifyRule(description.getRules().get(0), Policy.USER);
|
||||||
verifyRule(description.getRules().get(1), Policy.PRIMARY_GROUP);
|
verifyRule(description.getRules().get(1), Policy.PRIMARY_GROUP);
|
||||||
verifyRule(description.getRules().get(2), Policy.SECONDARY_GROUP);
|
verifyRule(description.getRules().get(2), Policy.SECONDARY_GROUP);
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -363,7 +363,7 @@ private void testConvertNestedRuleCreateFlagInWeightMode(
|
|||||||
any(Policy.class));
|
any(Policy.class));
|
||||||
verifyNoMoreInteractions(ruleHandler);
|
verifyNoMoreInteractions(ruleHandler);
|
||||||
} else {
|
} else {
|
||||||
verifyZeroInteractions(ruleHandler);
|
verifyNoInteractions(ruleHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,11 @@
|
|||||||
<artifactId>hadoop-yarn-applications-catalog-webapp</artifactId>
|
<artifactId>hadoop-yarn-applications-catalog-webapp</artifactId>
|
||||||
<type>war</type>
|
<type>war</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
Loading…
Reference in New Issue
Block a user