ProvisionClusterRequest extends BaseClusterRequest { public String getQuickLinksProfileJson() { return quickLinksProfileJson; } ProvisionClusterRequest(Map<String, Object> properties, SecurityConfiguration securityConfiguration); Map<String, Credential> getCredentialsMap(); String getClusterName(); void setClusterName(String clusterName); ConfigRecommendationStrategy getConfigRecommendationStrategy(); @Override Long getClusterId(); void setClusterId(Long clusterId); @Override Type getType(); @Override List<TopologyValidator> getTopologyValidators(); @Override String getDescription(); String getRepositoryVersion(); String getQuickLinksProfileJson(); static final String HOSTGROUPS_PROPERTY; static final String HOSTGROUP_NAME_PROPERTY; static final String HOSTGROUP_HOST_COUNT_PROPERTY; static final String HOSTGROUP_HOST_PREDICATE_PROPERTY; static final String HOSTGROUP_HOST_FQDN_PROPERTY; static final String HOSTGROUP_HOST_RACK_INFO_PROPERTY; static final String HOSTGROUP_HOSTS_PROPERTY; static final String CONFIGURATIONS_PROPERTY; static final String DEFAULT_PASSWORD_PROPERTY; static final String CONFIG_RECOMMENDATION_STRATEGY; static final String REPO_VERSION_PROPERTY; static final String QUICKLINKS_PROFILE_FILTERS_PROPERTY; static final String QUICKLINKS_PROFILE_SERVICES_PROPERTY; }
@Test public void testQuickLinksProfile_NoDataInRequest() throws Exception { Map<String, Object> properties = createBlueprintRequestProperties(CLUSTER_NAME, BLUEPRINT_NAME); ProvisionClusterRequest request = new ProvisionClusterRequest(properties, null); assertNull("No quick links profile is expected", request.getQuickLinksProfileJson()); }
@Test public void testQuickLinksProfile_OnlyGlobalFilterDataInRequest() throws Exception { Map<String, Object> properties = createBlueprintRequestProperties(CLUSTER_NAME, BLUEPRINT_NAME); properties.put(ProvisionClusterRequest.QUICKLINKS_PROFILE_FILTERS_PROPERTY, Sets.newHashSet(QuickLinksProfileBuilderTest.filter(null, null, true))); ProvisionClusterRequest request = new ProvisionClusterRequest(properties, null); assertEquals("Quick links profile doesn't match expected", "{\"filters\":[{\"visible\":true}],\"services\":[]}", request.getQuickLinksProfileJson()); }
@Test public void testQuickLinksProfile_OnlyServiceFilterDataInRequest() throws Exception { Map<String, Object> properties = createBlueprintRequestProperties(CLUSTER_NAME, BLUEPRINT_NAME); Map<String, String> filter = QuickLinksProfileBuilderTest.filter(null, null, true); Map<String, Object> hdfs = QuickLinksProfileBuilderTest.service("HDFS", null, Sets.newHashSet(filter)); Set<Map<String, Object>> services = Sets.newHashSet(hdfs); properties.put(ProvisionClusterRequest.QUICKLINKS_PROFILE_SERVICES_PROPERTY, services); ProvisionClusterRequest request = new ProvisionClusterRequest(properties, null); assertEquals("Quick links profile doesn't match expected", "{\"filters\":[],\"services\":[{\"name\":\"HDFS\",\"components\":[],\"filters\":[{\"visible\":true}]}]}", request.getQuickLinksProfileJson()); }
@Test public void testQuickLinksProfile_BothGlobalAndServiceLevelFilters() throws Exception { Map<String, Object> properties = createBlueprintRequestProperties(CLUSTER_NAME, BLUEPRINT_NAME); properties.put(ProvisionClusterRequest.QUICKLINKS_PROFILE_FILTERS_PROPERTY, Sets.newHashSet(QuickLinksProfileBuilderTest.filter(null, null, true))); Map<String, String> filter = QuickLinksProfileBuilderTest.filter(null, null, true); Map<String, Object> hdfs = QuickLinksProfileBuilderTest.service("HDFS", null, Sets.newHashSet(filter)); Set<Map<String, Object>> services = Sets.newHashSet(hdfs); properties.put(ProvisionClusterRequest.QUICKLINKS_PROFILE_SERVICES_PROPERTY, services); ProvisionClusterRequest request = new ProvisionClusterRequest(properties, null); System.out.println(request.getQuickLinksProfileJson()); assertEquals("Quick links profile doesn't match expected", "{\"filters\":[{\"visible\":true}],\"services\":[{\"name\":\"HDFS\",\"components\":[],\"filters\":[{\"visible\":true}]}]}", request.getQuickLinksProfileJson()); }