private void updateEncodingPresets(Resource configResource, S7Config s7Config, String typeHandle)
      throws RepositoryException {

    // Get the presets from S7 and store them on the node
    //
    List<Scene7PropertySet> propertySets = scene7Service.getPropertySets(typeHandle, s7Config);

    String path = configResource.getPath() + "/" + Scene7PresetsService.REL_PATH_ENCODING_PRESETS;
    Node node = prepNode(configResource.getResourceResolver(), path);
    Node presetNode;
    int i = 0;
    for (Scene7PropertySet propertySet : propertySets) {
      String handle = propertySet.getSetHandle();
      String nodeName = getNodeName(handle);
      if (StringUtils.isNotBlank(nodeName)) {
        presetNode = node.addNode(nodeName);
        presetNode.setProperty("handle", handle);
        Map<String, String> properties = propertySet.getProperties();
        for (String key : properties.keySet()) {
          String value = properties.get(key);
          key = StringUtils.uncapitalize(key);
          presetNode.setProperty(key, value);
        }
      }
    }
  }
  public TrainingProductImpl(Resource resource) {
    super(resource);

    resourceResolver = resource.getResourceResolver();
    pageManager = resourceResolver.adaptTo(PageManager.class);
    productPage = pageManager.getContainingPage(resource);
  }
  @Test
  public void testManyReferenceToSinglePages() throws Exception {
    Map<String, Object> map = new HashMap<String, Object>();
    String path = "/content/geometrixx/en";
    String path1 = "/content/geometrixx/en";
    map.put("path", path);
    map.put("path1", path1);
    ValueMap vm = new ValueMapDecorator(map);
    when(resource.getValueMap()).thenReturn(vm);
    when(resource.getResourceResolver()).thenReturn(resolver);
    when(resolver.getResource(path)).thenReturn(res);
    when(resolver.getResource(path1)).thenReturn(res1);
    when(res.adaptTo(Page.class)).thenReturn(referredpage);
    when(res1.adaptTo(Page.class)).thenReturn(referredpage);
    when(referredpage.getName()).thenReturn("geometrixx");
    when(referredpage1.getName()).thenReturn("geometrixx");
    when(referredpage1.getPath()).thenReturn(path1);
    when(manager.getContainingPage(path1)).thenReturn(referredpage1);
    Calendar cal = GregorianCalendar.getInstance();
    when(referredpage.getLastModified()).thenReturn(cal);
    when(referredpage1.getLastModified()).thenReturn(cal);
    List<Reference> actual = instance.findReferences(resource);

    assertNotNull(actual);
    assertEquals(1, actual.size());
    assertEquals("geometrixx (Page)", actual.get(0).getName());
  }
 public Resource next() {
   Principal nextPrincipal = principals.nextPrincipal();
   try {
     ResourceResolver resourceResolver = parent.getResourceResolver();
     if (resourceResolver != null) {
       Session session = resourceResolver.adaptTo(Session.class);
       if (session != null) {
         UserManager userManager = AccessControlUtil.getUserManager(session);
         if (userManager != null) {
           Authorizable authorizable = userManager.getAuthorizable(nextPrincipal.getName());
           if (authorizable != null) {
             String path;
             if (authorizable.isGroup()) {
               path = SYSTEM_USER_MANAGER_GROUP_PREFIX + nextPrincipal.getName();
             } else {
               path = SYSTEM_USER_MANAGER_USER_PREFIX + nextPrincipal.getName();
             }
             return new SakaiAuthorizableResource(authorizable, resourceResolver, path);
           }
         }
       }
     }
   } catch (RepositoryException re) {
     log.error("Exception while looking up authorizable resource.", re);
   }
   return null;
 }
  @Override
  public void sendMail(String emailRecipient, String message) {
    try {
      /*Should use subservice to get administrative resource resolver instead of this code*/
      ResourceResolver resourceResolver =
          resourceResolverFactory.getAdministrativeResourceResolver(null);
      Resource templateResource = resourceResolver.getResource(RabbitMQUtil.EMAIL_TEMPLATE_PATH);
      if (templateResource.getChild("file") != null) {
        templateResource = templateResource.getChild("file");
      }
      ArrayList<InternetAddress> emailRecipients = new ArrayList<InternetAddress>();
      final MailTemplate mailTemplate =
          MailTemplate.create(
              templateResource.getPath(),
              templateResource.getResourceResolver().adaptTo(Session.class));
      HtmlEmail email = new HtmlEmail();
      Map<String, String> mailTokens = new HashMap<String, String>();
      mailTokens.put("message", message);
      mailTokens.put("subject", "Dummy Subject");
      mailTokens.put("email", emailRecipient);
      if (mailTemplate != null) {

        emailRecipients.add(new InternetAddress(emailRecipient));
        email.setTo(emailRecipients);
        email.setSubject("Dummy Mail");
        email.setTextMsg(message);
        messageGateway = messageGatewayService.getGateway(HtmlEmail.class);
        messageGateway.send(email);
      }
    } catch (Exception e) {
      /*Put message in queue again in case of exception.. Based on type of exception, it can be decided whether it has to be put in queue again or not*/
      RabbitMQUtil.addMessageToQueue(scrService);
      e.printStackTrace(System.out);
    }
  }
Example #6
0
 /**
  * The promotion associated with the voucher. Promotions are used to apply some change to the
  * shopping cart once the voucher has been added.
  *
  * @return The voucher's promotion
  */
 public Promotion getPromotion() {
   ValueMap properties = resource.adaptTo(ValueMap.class);
   String promoPath = properties.get("jcr:content/promotion", String.class);
   if (promoPath != null && promoPath.length() > 0) {
     Resource promoResource = resource.getResourceResolver().getResource(promoPath);
     return (promoResource == null) ? null : promoResource.adaptTo(Promotion.class);
   } else {
     return null;
   }
 }
  private void updateViewerPresets(Resource configResource, S7Config s7Config)
      throws RepositoryException {

    // Get the presets from S7 and store them on the node
    //
    List<Scene7Asset> assets =
        scene7Service.searchAssets(
            s7Config.getBasePath(),
            Boolean.TRUE,
            Boolean.TRUE,
            new String[] {"ViewerPreset"},
            null,
            new String[] {
              "assetArray/items/assetHandle",
              "assetArray/items/type",
              "assetArray/items/name",
              "assetArray/items/viewerPresetInfo"
            },
            null,
            s7Config);

    if (assets.size() > 0) {
      String path = configResource.getPath() + "/" + Scene7PresetsService.REL_PATH_VIEWER_PRESETS;

      Node node = prepNode(configResource.getResourceResolver(), path);
      int i = 0;
      for (Scene7Asset asset : assets) {
        String name = asset.getName();
        String type = asset.getViewerPresetType();

        Node presetNode = node.addNode("preset" + i);
        presetNode.setProperty("name", name);
        presetNode.setProperty("type", (type != null ? type : ""));
        presetNode.setProperty("config", s7Config.getBasePath() + name);

        Map<String, String> viewerPresetConfigurationSettings =
            asset.getViewerPresetConfigurationSettings();
        if (viewerPresetConfigurationSettings != null
            && !viewerPresetConfigurationSettings.isEmpty()) {
          presetNode = presetNode.addNode("settings");
          for (Entry<String, String> entry : viewerPresetConfigurationSettings.entrySet()) {
            String settingName = entry.getKey();
            String value = entry.getValue();
            if (settingName != null && value != null) {
              presetNode.setProperty(settingName, value);
            }
          }
        }
        i++;
      }
    }
  }
  protected static Map<String, Map<Long, ResponseValue>> getTallyResponses(Resource tallyResource)
      throws JSONException {
    Map<String, Map<Long, ResponseValue>> returnValue =
        new HashMap<String, Map<Long, ResponseValue>>();
    final ResourceResolver resolver = tallyResource.getResourceResolver();
    final String tallyPath = tallyResource.getPath();
    if (!tallyPath.startsWith("/content/usergenerated")) {
      tallyResource = resolver.resolve("/content/usergenerated" + tallyPath);
    }
    final Resource responsesNode = tallyResource.getChild(TallyConstants.RESPONSES_PATH);
    if (responsesNode == null) {
      return null;
    }
    NestedBucketStorageSystem bucketSystem = getBucketSystem(responsesNode);
    if (null == bucketSystem) {
      return null;
    }

    final Iterator<Resource> buckets = bucketSystem.listBuckets();
    while (buckets.hasNext()) {
      final Resource bucketResource = buckets.next();
      final Node bucketNode = bucketResource.adaptTo(Node.class);
      try {
        final NodeIterator userNodesInBucket = bucketNode.getNodes();
        while (userNodesInBucket.hasNext()) {
          final Node userNode = userNodesInBucket.nextNode();
          final NestedBucketStorageSystem userBucketSystem =
              getBucketSystem(resolver.getResource(userNode.getPath()));
          final Iterator<Resource> userBuckets = userBucketSystem.listBuckets();
          final Map<Long, ResponseValue> userReturnValue = new HashMap<Long, ResponseValue>();
          while (userBuckets.hasNext()) {
            final NodeIterator userResponses = userBuckets.next().adaptTo(Node.class).getNodes();
            while (userResponses.hasNext()) {
              final Node responseNode = userResponses.nextNode();
              final Long responseTimestamp = responseNode.getProperty(TIMESTAMP_PROPERTY).getLong();
              userReturnValue.put(
                  responseTimestamp,
                  new PollResponse(responseNode.getProperty(RESPONSE_PROPERTY).getString()));
            }
          }
          returnValue.put(userNode.getName(), userReturnValue);
        }
      } catch (final RepositoryException e) {
        throw new JSONException(
            "Error trying to read user responses from bucket in " + bucketResource.getPath(), e);
      }
    }
    return returnValue;
  }
  /*
   * (non-Javadoc)
   * @see
   * org.apache.sling.api.resource.ResourceProvider#listChildren(org.apache
   * .sling.api.resource.Resource)
   */
  public Iterator<Resource> listChildren(Resource parent) {
    if (parent == null) {
      throw new NullPointerException("parent is null");
    }
    try {
      String path = parent.getPath();
      ResourceResolver resourceResolver = parent.getResourceResolver();

      // handle children of /system/userManager
      if (SYSTEM_USER_MANAGER_PATH.equals(path)) {
        List<Resource> resources = new ArrayList<Resource>();
        if (resourceResolver != null) {
          resources.add(getResource(resourceResolver, SYSTEM_USER_MANAGER_USER_PATH));
          resources.add(getResource(resourceResolver, SYSTEM_USER_MANAGER_GROUP_PATH));
        }
        return resources.iterator();
      }

      int searchType = -1;
      if (SYSTEM_USER_MANAGER_USER_PATH.equals(path)) {
        searchType = PrincipalManager.SEARCH_TYPE_NOT_GROUP;
      } else if (SYSTEM_USER_MANAGER_GROUP_PATH.equals(path)) {
        searchType = PrincipalManager.SEARCH_TYPE_GROUP;
      }
      if (searchType != -1) {
        PrincipalIterator principals = null;

        // TODO: this actually does not work correctly since the
        // jackrabbit findPrincipals API
        // currently does an exact match of the search filter so it
        // won't match a wildcard
        Session session = resourceResolver.adaptTo(Session.class);
        if (session != null) {
          PrincipalManager principalManager = AccessControlUtil.getPrincipalManager(session);
          principals =
              principalManager.findPrincipals(".*", PrincipalManager.SEARCH_TYPE_NOT_GROUP);
        }

        if (principals != null) {
          return new ChildrenIterator(parent, principals);
        }
      }
    } catch (RepositoryException re) {
      throw new SlingException("Error listing children of resource: " + parent.getPath(), re);
    }

    return null;
  }
  @Override
  public boolean updateViewerPresets(Resource configResource) {
    try {
      S7Config s7Config = s7configResolver.getS7Config(configResource.getParent().getPath());
      S7Config sharedConfig = s7configResolver.getSharedS7Config(s7Config);

      updateViewerPresets(configResource, s7Config); // custom presets
      Resource shared = configResource.getParent().getParent();
      updateViewerPresets(shared, sharedConfig); // shared presets

      Session session = configResource.getResourceResolver().adaptTo(Session.class);
      session.save();

      return true;
    } catch (RepositoryException e) {
      LOG.error(e.getMessage(), e);
    }
    return false;
  }
 @Before
 public void setUp() throws Exception {
   Map<String, Object> map = new HashMap<String, Object>();
   String path = "/content/geometrixx/en";
   map.put("path", path);
   ValueMap vm = new ValueMapDecorator(map);
   when(resource.getValueMap()).thenReturn(vm);
   when(resource.getResourceResolver()).thenReturn(resolver);
   when(resolver.adaptTo(PageManager.class)).thenReturn(manager);
   when(manager.getContainingPage(path)).thenReturn(referredpage);
   when(referredpage.getPath()).thenReturn(path);
   when(resource.listChildren()).thenReturn(iter);
   when(iter.hasNext()).thenReturn(false);
   when(resolver.getResource(path)).thenReturn(res);
   when(res.adaptTo(Page.class)).thenReturn(referredpage);
   when(referredpage.getName()).thenReturn("geometrixx");
   Calendar cal = GregorianCalendar.getInstance();
   when(referredpage.getLastModified()).thenReturn(cal);
 }
 /**
  * Searches up the resource super type hierarchy to create a list of available templates. This
  * list can have duplicates in it and should respect the app and libs folder.
  *
  * @param resource the resource to start getting templates for
  * @return list of templates that are available for this resource
  */
 private List<String> collectTemplates(final Resource resource) {
   final List<String> templates = new ArrayList<String>();
   if (resource == null) {
     return templates;
   }
   final ResourceResolver resourceResolver = resource.getResourceResolver();
   if (resource.getResourceSuperType() != null) {
     templates.addAll(
         collectTemplates(resourceResolver.getResource(resource.getResourceSuperType())));
   }
   final Iterator<Resource> childIterator = resource.listChildren();
   String templateName;
   while (childIterator.hasNext()) {
     templateName = childIterator.next().getName();
     if (templateName.matches(TEMPLATE_MASK)) {
       templates.add(templateName);
     }
   }
   return templates;
 }
Example #13
0
  @SuppressWarnings("unchecked")
  private <AdapterType> AdapterType getAdapter(
      final Resource resource, final Class<AdapterType> type) {
    try {
      if (FORUM_CLASS == type) {
        return (AdapterType) new ForumImpl(resource, eventAdmin);
      } else if (POST_CLASS == type || MUTABLE_POST_CLASS == type) {
        return (AdapterType)
            new PostImpl(
                resource,
                resource.getResourceResolver(),
                eventAdmin,
                notificationManager,
                workflowService);
      }
    } catch (final ForumException e) {
      log.debug("failed adapting resource [{}] to [" + type + "]: {}", resource.getPath(), e);
    }

    return null;
  }
  @Test
  public void testMultipleReferencesReferenceToPages() throws Exception {
    Map<String, Object> map = new HashMap<String, Object>();
    String path = "\"/content/geometrixx/en\",\"/content/geometrixx/en/toolbar\"";
    String path1 = "/content/geometrixx/en/toolbar";
    map.put("path", path);
    // map.put("path1", path1);
    ValueMap vm = new ValueMapDecorator(map);
    when(resource.getValueMap()).thenReturn(vm);
    when(resource.getResourceResolver()).thenReturn(resolver);
    when(resolver.getResource(path)).thenReturn(res);
    when(resolver.getResource(path1)).thenReturn(res1);
    when(res.adaptTo(Page.class)).thenReturn(referredpage);
    when(res1.adaptTo(Page.class)).thenReturn(referredpage1);
    when(referredpage.getName()).thenReturn("geometrixx");
    when(referredpage1.getName()).thenReturn("geometrixx1");
    when(referredpage1.getPath()).thenReturn(path1);
    when(manager.getContainingPage(path1)).thenReturn(referredpage1);
    Calendar cal = GregorianCalendar.getInstance();
    when(referredpage.getLastModified()).thenReturn(cal);
    when(referredpage1.getLastModified()).thenReturn(cal);
    List<Reference> actual = instance.findReferences(resource);

    assertNotNull(actual);
    assertEquals(2, actual.size());

    boolean geometrixxFound = false;
    boolean geometrixxOneFound = false;
    for (Reference ref : actual) {
      if (ref.getName().equals("geometrixx (Page)")) {
        geometrixxFound = true;
      } else if (ref.getName().equals("geometrixx1 (Page)")) {
        geometrixxOneFound = true;
      }
    }

    assertTrue(geometrixxFound);
    assertTrue(geometrixxOneFound);
  }
  private Resource mockResource(String path, File file) {
    // Get the inputstream for this file (null if directory.)
    InputStream in = getStream(file);

    // Mock the resource
    Resource resource = mock(Resource.class);
    when(resource.adaptTo(InputStream.class)).thenReturn(in);
    when(resource.adaptTo(File.class)).thenReturn(file);
    when(resource.getResourceResolver()).thenReturn(resolver);
    when(resource.getPath()).thenReturn(path);

    // Add the resource to the resource resolver.
    when(resolver.getResource(path)).thenReturn(resource);

    // Mock all the children
    List<Resource> resources = mockFileChildren(path, file);
    when(resolver.listChildren(resource)).thenReturn(resources.iterator());

    // If not using ResourceUtil
    when(resource.listChildren()).thenReturn(resources.iterator());
    when(resource.getName()).thenReturn(file.getName());
    return resource;
  }
 protected void assertEquals(ResourceProviderEntry resProviderEntry, Resource res) {
   assertEquals(resProviderEntry.getResourceProvider(), res.getResourceResolver());
 }
 /**
  * Returns Locale on the basis of Current page.
  *
  * @param resource the Resource
  * @return Locale
  */
 public static Locale getLocaleFromPage(final Resource resource) {
   final PageManager pageManager = resource.getResourceResolver().adaptTo(PageManager.class);
   final Page currentPage = pageManager.getContainingPage(resource);
   return currentPage.getLanguage(false);
 }
Example #18
0
  /** @see WorkflowProcess#execute(WorkItem, WorkflowSession, MetaDataMap) */
  public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args)
      throws WorkflowException {
    final Session session = workflowSession.getSession();
    final WorkflowData data = workItem.getWorkflowData();
    String path = null;
    String type = data.getPayloadType();
    try {
      if (type.equals(TYPE_JCR_PATH) && data.getPayload() != null) {
        String payloadData = (String) data.getPayload();
        if (session.itemExists(payloadData)) {
          path = payloadData;
        }
      }

      if (path != null) {
        final Node userGeneratedNode = (Node) session.getItem(path);

        if (userGeneratedNode.hasProperty(SLING_RESOURCE_TYPE)
            && userGeneratedNode
                .getProperty(SLING_RESOURCE_TYPE)
                .getString()
                .equals(COMMENT_RESOURCE_TYPE)) {

          logger.debug("Spam check for comment node at " + userGeneratedNode.getPath());
          String ipAddress = null;
          if (userGeneratedNode.hasProperty("ip")) {
            ipAddress = userGeneratedNode.getProperty("ip").getString();
            logger.debug("Spam check for comment node with ip " + ipAddress);
          } else {
            setIsSpam(userGeneratedNode, false, session);
            logger.info("Comment has no IP address, setting isSpam to false");
            return;
          }
          // if the ip is localhost we set isspam to false as well
          if (ipAddress.equalsIgnoreCase("127.0.0.1")
              || ipAddress.equalsIgnoreCase("localhost")
              || ipAddress.equalsIgnoreCase("0:0:0:0:0:0:0:1")) {
            setIsSpam(userGeneratedNode, false, session);
            logger.info("Comment IP address is localhost, setting isSpam to false");
            return;
          }

          String userAgent = null;
          if (userGeneratedNode.hasProperty("userAgent")) {
            userAgent = userGeneratedNode.getProperty("userAgent").getString();
            logger.debug("Spam check for comment node with userAgent " + userAgent);
          } else {
            setIsSpam(userGeneratedNode, false, session);
            logger.info("Comment has no user agent, setting isSpam to false");
            return;
          }

          String referrer = null;
          if (userGeneratedNode.hasProperty("referer")) {
            referrer = userGeneratedNode.getProperty("referer").getString();
            logger.debug("Spam check for comment node with referrer " + referrer);
          }

          String permalink = null;
          try {
            ResourceResolver resourceResolver =
                jcrResourceResolverFactory.getResourceResolver(session);
            Resource resource = resourceResolver.getResource(path);
            BlogManager blogManager = resource.getResourceResolver().adaptTo(BlogManager.class);
            Blog entry = blogManager.getBlog(path);
            permalink = entry.getFullUrl();
            logger.debug("Spam check for comment node with permalink " + permalink);
          } catch (Exception e) {
            logger.error("Exception " + e.toString() + " getting permalink");
          }

          String author = null;
          if (userGeneratedNode.hasProperty("userIdentifier")) {
            author = userGeneratedNode.getProperty("userIdentifier").getString();
            logger.debug("Spam check for comment node with permalink " + author);
          }
          String authorEmail = null;
          if (userGeneratedNode.hasProperty("email")) {
            authorEmail = userGeneratedNode.getProperty("email").getString();
            logger.debug("Spam check for comment node with author " + authorEmail);
          }
          String authorURL = null;
          if (userGeneratedNode.hasProperty("url")) {
            authorURL = userGeneratedNode.getProperty("url").getString();
            logger.debug("Spam check for comment node with authorURL " + authorURL);
          }
          String commentText = null;
          if (userGeneratedNode.hasProperty("jcr:description")) {
            commentText = userGeneratedNode.getProperty("jcr:description").getString();
            logger.debug("Spam check for comment node with commentText " + commentText);
          }

          boolean isSpam =
              akismetService.commentCheck(
                  ipAddress,
                  userAgent,
                  referrer,
                  permalink,
                  "comment",
                  author,
                  authorEmail,
                  authorURL,
                  commentText,
                  null);

          setIsSpam(userGeneratedNode, isSpam, session);

          logger.info("Spam check result " + isSpam + " for comment: " + workItem.toString());

        } else if (userGeneratedNode.hasProperty(SLING_RESOURCE_TYPE)
            && userGeneratedNode
                .getProperty(SLING_RESOURCE_TYPE)
                .getString()
                .equals(TRACKBACK_RESOURCE_TYPE)) { // for
          // trackbacks

          String ipAddress = null;
          if (userGeneratedNode.hasProperty("ip")) {
            ipAddress = userGeneratedNode.getProperty("ip").getString();
            logger.debug("Spam check for trackback node with ip " + ipAddress);
          }

          String authorURL = null;
          if (userGeneratedNode.hasProperty("url")) {
            authorURL = userGeneratedNode.getProperty("url").getString();
            logger.debug("Spam check for trackback node with authorURL " + authorURL);
          }

          String permalink = null;
          try {
            ResourceResolver resourceResolver =
                jcrResourceResolverFactory.getResourceResolver(session);
            Resource resource = resourceResolver.getResource(path);
            BlogManager blogManager = resource.getResourceResolver().adaptTo(BlogManager.class);
            Blog entry = blogManager.getBlog(path);
            permalink = entry.getFullUrl();
            logger.debug("Spam check for trackback node with permalink " + permalink);
          } catch (Exception e) {
            logger.error("Exception " + e.toString() + " getting permalink");
          }

          /*
           * it is not really clear from the akismet api how to map
           * the trackback's title and blog-name to the api call. will
           * try with the code below.
           */

          String author = null;
          if (userGeneratedNode.hasProperty("blogName")) {
            author = userGeneratedNode.getProperty("blogName").getString();
            logger.debug("Spam check for trackback node with blogName " + author);
          }

          // prepending the title to the excerpt
          String excerpt = "";
          if (userGeneratedNode.hasProperty("excerpt")) {
            excerpt = userGeneratedNode.getProperty("excerpt").getString();
            logger.debug("Spam check for trackback node with excerpt " + excerpt);
          }
          if (userGeneratedNode.hasProperty("jcr:title")) {
            excerpt = userGeneratedNode.getProperty("jcr:title").getString() + " " + excerpt;
            logger.debug(
                "Spam check for trackback node with title "
                    + userGeneratedNode.hasProperty("jcr:title"));
          }

          boolean isSpam =
              akismetService.commentCheck(
                  ipAddress,
                  null,
                  null,
                  permalink,
                  "trackback",
                  author,
                  null,
                  authorURL,
                  excerpt,
                  null);

          setIsSpam(userGeneratedNode, isSpam, session);

          logger.info("Spam check result " + isSpam + " for trackback: " + workItem.toString());

        } else {
          logger.warn(
              "Cannot check for spam because item is not a comment or a trackback. Workitem: "
                  + workItem.toString());
        }
      } else {
        logger.warn(
            "Cannot check for spam because path is null for this workitem: " + workItem.toString());
      }
    } catch (RepositoryException e) {
      throw new WorkflowException(e);
    }
  }
 protected void assertEquals(ResourceProvider resProvider, Resource res) {
   assertEquals(resProvider, res.getResourceResolver());
 }