@Test public void testApplicable() throws Exception { final Service service = EasyMock.createMock(Service.class); Map<String, Service> services = new HashMap<>(); services.put("RANGER", service); Cluster cluster = m_clusters.getCluster("cluster"); EasyMock.reset(cluster); expect(cluster.getServices()).andReturn(services).anyTimes(); expect(cluster.getCurrentStackVersion()).andReturn(new StackId("HDP-2.3")).anyTimes(); replay(cluster); PrereqCheckRequest request = new PrereqCheckRequest("cluster"); request.setSourceStackId(new StackId("HDP-2.3")); assertTrue(m_rpc.isApplicable(request)); request = new PrereqCheckRequest("cluster"); request.setSourceStackId(new StackId("HDP-2.2")); assertFalse(m_rpc.isApplicable(request)); EasyMock.reset(cluster); expect(cluster.getServices()).andReturn(services).anyTimes(); expect(cluster.getCurrentStackVersion()).andReturn(new StackId("WILDSTACK-2.0")).anyTimes(); replay(cluster); request = new PrereqCheckRequest("cluster"); request.setSourceStackId(new StackId("HDP-2.2")); assertTrue(m_rpc.isApplicable(request)); }
@Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { if (!super.isApplicable(request, Arrays.asList("RANGER"), true)) { return false; } final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); StackId clusterStackId = cluster.getCurrentStackVersion(); if (clusterStackId.getStackName().equals("HDP")) { String sourceVersion = request.getSourceStackId().getStackVersion(); return VersionUtils.compareVersions(sourceVersion, "2.3.0.0") >= 0; } return true; }
RangerPasswordCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { if (!super.isApplicable(request, Arrays.asList("RANGER"), true)) { return false; } final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); StackId clusterStackId = cluster.getCurrentStackVersion(); if (clusterStackId.getStackName().equals("HDP")) { String sourceVersion = request.getSourceStackId().getStackVersion(); return VersionUtils.compareVersions(sourceVersion, "2.3.0.0") >= 0; } return true; } }
RangerPasswordCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { if (!super.isApplicable(request, Arrays.asList("RANGER"), true)) { return false; } final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); StackId clusterStackId = cluster.getCurrentStackVersion(); if (clusterStackId.getStackName().equals("HDP")) { String sourceVersion = request.getSourceStackId().getStackVersion(); return VersionUtils.compareVersions(sourceVersion, "2.3.0.0") >= 0; } return true; } RangerPasswordCheck(); }
RangerPasswordCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { if (!super.isApplicable(request, Arrays.asList("RANGER"), true)) { return false; } final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); StackId clusterStackId = cluster.getCurrentStackVersion(); if (clusterStackId.getStackName().equals("HDP")) { String sourceVersion = request.getSourceStackId().getStackVersion(); return VersionUtils.compareVersions(sourceVersion, "2.3.0.0") >= 0; } return true; } RangerPasswordCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck check, PrereqCheckRequest request); }
RangerPasswordCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { if (!super.isApplicable(request, Arrays.asList("RANGER"), true)) { return false; } final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); StackId clusterStackId = cluster.getCurrentStackVersion(); if (clusterStackId.getStackName().equals("HDP")) { String sourceVersion = request.getSourceStackId().getStackVersion(); return VersionUtils.compareVersions(sourceVersion, "2.3.0.0") >= 0; } return true; } RangerPasswordCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck check, PrereqCheckRequest request);  }