From Allon Mureinik <amureini(a)redhat.com>:
Allon Mureinik has submitted this change and it was merged.
Change subject: engine: Upgrade to Mockito 2.6.5
......................................................................
engine: Upgrade to Mockito 2.6.5
The Mockito 1.x generation is outdated, and the beginning of the work on
oVirt 4.2 is a good time to upgrade our testing facilities.
This patch upgrades to the latest available Mockito version, 2.6.5.
Some of the benefits of this upgrade include:
1. Working with a live, maintained, library.
2. Support for Java 8 syntax.
3. Improved generics support, lending to cleaner code.
4. Improved performance.
Since Mockito's 2.x generation is not fully backwards compatible with
the 1.x generation, this patch includes several changes other than a
trivial version bump:
1. In Mockito 1.x, ArgumentMatcher is an abstract class, and in 2.x it
it is a [functional] interface, so custom ArgumentMatcher
implementations had to be changed accordingly. Where possible, the
cumbersome anonymous implementation was replaced with a lambda, for
brevity's sake.
Note that in the 1.x generation an ArgumentMatcher<T>'s matches
method accepted an Object, while in 2.x it is generalized, and
accepts T. This change makes it safer in compile time, and allows
the removal of the boiler-plate instanceof checks and casts.
Also note that org.mockito.ArgumentMatcher no longer has any
relation to org.hamcrest.Matcher, so places the two were used
interchangeably also had to be fixed.
2. In Mockito 1.x any(T) matches also null values, but in 2.x it does
not. Where fixing the mocking was possible without causing too much
disruption to test, a separate patch was sent to handle it. Where
it was not possible (with a reasonable amount of effort), the
any(T) calls where replaced with any() or nullable(T) calls, which
do accept nulls.
3. In Mockito 1.x unused stubbing does not have any adverse effect
(besides wasting some of CPU cycles, of course). In Mokcito 2.x, the
default behavior is to fail a test with unused stubbing. In the cases
where it was reasonable to fix these unused stubbings, separate
patches were sent (prior to this one). In the cases it wasn't, the
runner was replaced with
org.mockito.junit.MockitoJUnitRunner.Silent, which allows unused
stubs, just like the Mockito 1.x used to.
Change-Id: I32e3fa044426cfc670a45235f54d086045bf4a48
Signed-off-by: Allon Mureinik <amureini(a)redhat.com>
---
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddUnmanagedVmsCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVmFromTemplateCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetErrataCountsForHostQueryTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetVmOvfByVmIdQueryTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateClusterCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVmCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateWatchdogCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/exportimport/ImportVMFromConfigurationCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/exportimport/ImportVmCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeGeoRepSessionCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/DisableGlusterHookCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/EnableGlusterHookCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJobTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterServiceSyncJobTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterSnapshotSyncJobTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJobTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/RefreshGlusterVolumeDetailsCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/RemoveGlusterHookCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StopRemoveGlusterVolumeBricksCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/StorageDeviceSyncJobTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/hostdeploy/AddVdsCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToClusterInternalCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/dc/AddNetworkValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/host/HostSetupNetworksValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/host/NicLabelValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/host/UpdateHostNicVfsConfigCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/host/VfSchedulerImplTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/pm/StartVdsCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/provider/RemoveProviderValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/scheduling/AffinityRulesEnforcementManagerTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/scheduling/commands/AddAffinityGroupCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/GetAllVmSnapshotsFromConfigurationByVmIdQueryTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/RemoveDiskSnapshotsCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/RestoreAllSnapshotsCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/AddDiskCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/AttachDiskToVmCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/HotPlugDiskToVmCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/MoveOrCopyDiskCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/AbstractGetStorageDomainsWithAttachedStoragePoolGuidQueryTestCase.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/lsm/LiveMigrateVmDisksCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/UpdateStoragePoolCommandTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/ClusterValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/HostValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/NetworkValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/UpdateHostValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/VnicProfileValidatorTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/MultipleStorageDomainsValidatorTest.java
M
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java
M
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/test/util/TestHelper.java
M
backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/servlet/LocaleFilterTest.java
M
backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/servlet/UnsupportedLocaleHelperTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/CalculateBaseNicTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/monitoring/LunDisksMonitoringTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/monitoring/MultipleServicesMonitoringStrategyTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/monitoring/VirtMonitoringStrategyTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/monitoring/VmJobsMonitoringTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommandTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/vdsbroker/HostNetworkAttachmentsPersisterTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmSerialNumberBuilderTest.java
M
backend/manager/modules/welcome/src/test/java/org/ovirt/engine/core/WelcomeServletTest.java
M
frontend/webadmin/modules/frontend/src/test/java/org/ovirt/engine/ui/frontend/server/gwt/AbstractGwtDynamicHostPageServletTest.java
M
frontend/webadmin/modules/frontend/src/test/java/org/ovirt/engine/ui/frontend/server/gwt/WebAdminHostPageServletTest.java
M
frontend/webadmin/modules/gwt-common/src/test/java/org/ovirt/engine/ui/common/binding/ElementIdTypeParserTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/action/UiVdcActionTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/action/UiVdcMultipleActionTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/ExecuteNetworkCommandInNetworkOperationTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModelTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModelTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateVmModelBehaviorTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModelTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModelTest.java
M
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModelTest.java
M pom.xml
79 files changed, 432 insertions(+), 706 deletions(-)
Approvals:
Jenkins CI: Passed CI tests
Allon Mureinik: Verified
Moti Asayag: Looks good to me, approved
--
To view, visit
https://gerrit.ovirt.org/70293
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I32e3fa044426cfc670a45235f54d086045bf4a48
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Arik Hadas <ahadas(a)redhat.com>
Gerrit-Reviewer: Daniel Erez <derez(a)redhat.com>
Gerrit-Reviewer: Idan Shaby <ishaby(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez(a)redhat.com>
Gerrit-Reviewer: Martin Betak <mbetak(a)redhat.com>
Gerrit-Reviewer: Martin Mucha <mmucha(a)redhat.com>
Gerrit-Reviewer: Martin Peřina <mperina(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Moti Asayag <masayag(a)redhat.com>
Gerrit-Reviewer: Sahina Bose <sabose(a)redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan(a)redhat.com>
Gerrit-Reviewer: Yevgeny Zaspitsky <yzaspits(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>