@Test public void testGetSettings_instance(){ Result result = new ResultImpl(true); TreeNode<Resource> resultTree = createResultTreeSettingsObject(result.getResultTree()); ClusterBlueprintRenderer renderer = new TestBlueprintRenderer(topology); Result blueprintResult = renderer.finalizeResult(result); TreeNode<Resource> blueprintTree = blueprintResult.getResultTree(); TreeNode<Resource> blueprintNode = blueprintTree.getChildren().iterator().next(); Resource blueprintResource = blueprintNode.getObject(); Map<String, Map<String, Object>> propertiesMap = blueprintResource.getPropertiesMap(); Map<String,Object> children = propertiesMap.get(""); assertTrue(children.containsKey("settings")); List<Map<String,Object>> settingValues = (ArrayList)children.get("settings"); Boolean isRecoverySettings = false; Boolean isComponentSettings = false; Boolean isServiceSettings = false; for(Map<String,Object> settingProp : settingValues){ if(settingProp.containsKey("recovery_settings")){ isRecoverySettings = true; HashSet<Map<String,String>> checkPropSize = (HashSet)settingProp.get("recovery_settings"); assertEquals(1,checkPropSize.size()); assertEquals("true",checkPropSize.iterator().next().get("recovery_enabled")); } if(settingProp.containsKey("component_settings")){ isComponentSettings = true; HashSet<Map<String,String>> checkPropSize = (HashSet)settingProp.get("component_settings"); assertEquals(1,checkPropSize.size()); Map<String, String> finalProp = checkPropSize.iterator().next(); assertEquals("Component:1",finalProp.get("name")); assertEquals("true",finalProp.get("recovery_enabled")); } if(settingProp.containsKey("service_settings")){ isServiceSettings = true; HashSet<Map<String,String>> checkPropSize = (HashSet)settingProp.get("service_settings"); assertEquals(2,checkPropSize.size()); for(Map<String,String> finalProp : checkPropSize){ if(finalProp.containsKey("credential_store_enabled")){ assertEquals("Service:1",finalProp.get("name")); assertEquals("true",finalProp.get("recovery_enabled")); } assertFalse(finalProp.get("name").equals("Service:3")); } } } assertTrue(isRecoverySettings); assertTrue(isComponentSettings); assertTrue(isServiceSettings); }
@Override public Result finalizeResult(Result queryResult) { TreeNode<Resource> resultTree = queryResult.getResultTree(); Result result = new ResultImpl(true); TreeNode<Resource> blueprintResultTree = result.getResultTree(); if (isCollection(resultTree)) { blueprintResultTree.setProperty("isCollection", "true"); } for (TreeNode<Resource> node : resultTree.getChildren()) { Resource blueprintResource = createBlueprintResource(node); blueprintResultTree.addChild(new TreeNodeImpl<Resource>( blueprintResultTree, blueprintResource, node.getName())); } return result; }
ClusterBlueprintRenderer extends BaseRenderer implements Renderer { @Override public Result finalizeResult(Result queryResult) { TreeNode<Resource> resultTree = queryResult.getResultTree(); Result result = new ResultImpl(true); TreeNode<Resource> blueprintResultTree = result.getResultTree(); if (isCollection(resultTree)) { blueprintResultTree.setProperty("isCollection", "true"); } for (TreeNode<Resource> node : resultTree.getChildren()) { Resource blueprintResource = createBlueprintResource(node); blueprintResultTree.addChild(new TreeNodeImpl<Resource>( blueprintResultTree, blueprintResource, node.getName())); } return result; } }
ClusterBlueprintRenderer extends BaseRenderer implements Renderer { @Override public Result finalizeResult(Result queryResult) { TreeNode<Resource> resultTree = queryResult.getResultTree(); Result result = new ResultImpl(true); TreeNode<Resource> blueprintResultTree = result.getResultTree(); if (isCollection(resultTree)) { blueprintResultTree.setProperty("isCollection", "true"); } for (TreeNode<Resource> node : resultTree.getChildren()) { Resource blueprintResource = createBlueprintResource(node); blueprintResultTree.addChild(new TreeNodeImpl<Resource>( blueprintResultTree, blueprintResource, node.getName())); } return result; }  }
ClusterBlueprintRenderer extends BaseRenderer implements Renderer { @Override public Result finalizeResult(Result queryResult) { TreeNode<Resource> resultTree = queryResult.getResultTree(); Result result = new ResultImpl(true); TreeNode<Resource> blueprintResultTree = result.getResultTree(); if (isCollection(resultTree)) { blueprintResultTree.setProperty("isCollection", "true"); } for (TreeNode<Resource> node : resultTree.getChildren()) { Resource blueprintResource = createBlueprintResource(node); blueprintResultTree.addChild(new TreeNodeImpl<Resource>( blueprintResultTree, blueprintResource, node.getName())); } return result; }  @Override TreeNode<Set<String>> finalizeProperties(
      TreeNode<QueryInfo> queryProperties, boolean isCollection); @Override Result finalizeResult(Result queryResult); @Override ResultPostProcessor getResultPostProcessor(Request request); @Override boolean requiresPropertyProviderInput(); }
ClusterBlueprintRenderer extends BaseRenderer implements Renderer { @Override public Result finalizeResult(Result queryResult) { TreeNode<Resource> resultTree = queryResult.getResultTree(); Result result = new ResultImpl(true); TreeNode<Resource> blueprintResultTree = result.getResultTree(); if (isCollection(resultTree)) { blueprintResultTree.setProperty("isCollection", "true"); } for (TreeNode<Resource> node : resultTree.getChildren()) { Resource blueprintResource = createBlueprintResource(node); blueprintResultTree.addChild(new TreeNodeImpl<Resource>( blueprintResultTree, blueprintResource, node.getName())); } return result; }  @Override TreeNode<Set<String>> finalizeProperties(
      TreeNode<QueryInfo> queryProperties, boolean isCollection); @Override Result finalizeResult(Result queryResult); @Override ResultPostProcessor getResultPostProcessor(Request request); @Override boolean requiresPropertyProviderInput();  }