@Test public void testIsApplicable() throws Exception { final Cluster cluster = Mockito.mock(Cluster.class); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); Mockito.when(cluster.getCurrentStackVersion()).thenReturn(new StackId("HDP-2.3")); Map<String, Service> services = new HashMap<String, Service>(); Mockito.when(cluster.getServices()).thenReturn(services); ClusterVersionEntity clusterVersionEntity = Mockito.mock(ClusterVersionEntity.class); Mockito.when(cluster.getCurrentClusterVersion()).thenReturn(clusterVersionEntity); PrereqCheckRequest request = new PrereqCheckRequest("cluster"); request.setTargetStackId(new StackId("HDP", "2.3.1.1")); request.setSourceStackId(new StackId("HDP", "2.3.0.0")); Assert.assertFalse(m_check.isApplicable(request)); services.put("MAPREDUCE2", Mockito.mock(Service.class)); Assert.assertTrue(m_check.isApplicable(request)); }
@Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { return super.isApplicable(request, Arrays.asList("MAPREDUCE2"), true); }
MapReduce2JobHistoryStatePreservingCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { return super.isApplicable(request, Arrays.asList("MAPREDUCE2"), true); } }
MapReduce2JobHistoryStatePreservingCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { return super.isApplicable(request, Arrays.asList("MAPREDUCE2"), true); } MapReduce2JobHistoryStatePreservingCheck(); }
MapReduce2JobHistoryStatePreservingCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { return super.isApplicable(request, Arrays.asList("MAPREDUCE2"), true); } MapReduce2JobHistoryStatePreservingCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); }
MapReduce2JobHistoryStatePreservingCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { return super.isApplicable(request, Arrays.asList("MAPREDUCE2"), true); } MapReduce2JobHistoryStatePreservingCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }