@Test public void whenInvalidProfileIsSetAllLinksAreVisible() throws Exception { quicklinkProfile = "{}"; QuickLinkArtifactResourceProvider provider = createProvider(); Predicate predicate = new PredicateBuilder().property( QuickLinkArtifactResourceProvider.STACK_NAME_PROPERTY_ID).equals("HDP"). and(). property(QuickLinkArtifactResourceProvider.STACK_VERSION_PROPERTY_ID).equals("2.0.6"). and(). property(QuickLinkArtifactResourceProvider.STACK_SERVICE_NAME_PROPERTY_ID).equals("YARN"). toPredicate(); Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(Sets.<String>newHashSet()), predicate); Map<String, Link> linkMap = getLinks(resources); for (Link link: linkMap.values()) { assertTrue("All links should be visible.", link.isVisible()); } }
@Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new LinkedHashSet<Resource>(); resources.addAll(getQuickLinks(request, predicate)); if (resources.isEmpty()) { throw new NoSuchResourceException( "The requested resource doesn't exist: QuickLink not found, " + predicate); } return resources; }
QuickLinkArtifactResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new LinkedHashSet<Resource>(); resources.addAll(getQuickLinks(request, predicate)); if (resources.isEmpty()) { throw new NoSuchResourceException( "The requested resource doesn't exist: QuickLink not found, " + predicate); } return resources; } }
QuickLinkArtifactResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new LinkedHashSet<Resource>(); resources.addAll(getQuickLinks(request, predicate)); if (resources.isEmpty()) { throw new NoSuchResourceException( "The requested resource doesn't exist: QuickLink not found, " + predicate); } return resources; } protected  QuickLinkArtifactResourceProvider(AmbariManagementController managementController); }
QuickLinkArtifactResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new LinkedHashSet<Resource>(); resources.addAll(getQuickLinks(request, predicate)); if (resources.isEmpty()) { throw new NoSuchResourceException( "The requested resource doesn't exist: QuickLink not found, " + predicate); } return resources; } protected  QuickLinkArtifactResourceProvider(AmbariManagementController managementController); @Override RequestStatus createResources(Request request); @Override Set<Resource> getResources(Request request, Predicate predicate); @Override RequestStatus updateResources(Request request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate); }
QuickLinkArtifactResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new LinkedHashSet<Resource>(); resources.addAll(getQuickLinks(request, predicate)); if (resources.isEmpty()) { throw new NoSuchResourceException( "The requested resource doesn't exist: QuickLink not found, " + predicate); } return resources; } protected  QuickLinkArtifactResourceProvider(AmbariManagementController managementController); @Override RequestStatus createResources(Request request); @Override Set<Resource> getResources(Request request, Predicate predicate); @Override RequestStatus updateResources(Request request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate); static final String STACK_NAME_PROPERTY_ID; static final String STACK_VERSION_PROPERTY_ID; static final String STACK_SERVICE_NAME_PROPERTY_ID; static final String QUICKLINK_DEFAULT_PROPERTY_ID; static final String QUICKLINK_FILE_NAME_PROPERTY_ID; static final String QUICKLINK_DATA_PROPERTY_ID; static Set<String> pkPropertyIds; static Map<Resource.Type, String> keyPropertyIds; static Set<String> propertyIds; }