test_class.declarator: context = new SlingContext()
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final SlingContext context = new SlingContext();
test_class.type: SlingContext
test_class.var_name: context
test_class.declarator: transformer
test_class.modifier: private
test_class.original_string: private Transformer transformer;
test_class.type: Transformer
test_class.var_name: transformer
test_class.file: transformer/src/test/java/org/apache/sling/cms/transformer/internal/TransformerImplTest.java
test_class.identifier: TransformerImplTest
test_case.body: @Test
      public void testImageThumbnail() throws IOException {
          context.currentResource("/content/apache/sling-apache-org/index/apache.png");
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          TransformationImpl transformation = new TransformationImpl();
          List<Resource> handlers = new ArrayList<>();
  
          Map<String, Object> size = new HashMap<>();
          size.put(SizeHandler.PN_WIDTH, 200);
          size.put(SizeHandler.PN_HEIGHT, 200);
          size.put(ResourceResolver.PROPERTY_RESOURCE_TYPE, "sling-cms/components/caconfig/transformationhandlers/size");
          handlers.add(new MockResource("/conf", size, Mockito.mock(ResourceResolver.class)));
  
          Map<String, Object> crop = new HashMap<>();
          crop.put(CropHandler.PN_POSITION, "center");
          crop.put(ResourceResolver.PROPERTY_RESOURCE_TYPE, "sling-cms/components/caconfig/transformationhandlers/crop");
          handlers.add(new MockResource("/conf", crop, Mockito.mock(ResourceResolver.class)));
  
          transformation.sethandlers(handlers);
          transformer.transform(context.currentResource(), transformation, OutputFileFormat.PNG, baos);
          assertNotNull(baos);
  
          IOUtils.copy(new ByteArrayInputStream(baos.toByteArray()), new File("src/test/resources/thumbnail.png"));
      }
test_case.class_method_signature: TransformerImplTest.testImageThumbnail()
test_case.full_signature: @Test public void testImageThumbnail()
test_case.identifier: testImageThumbnail
test_case.invocations: currentResource put put put add mock put put add mock sethandlers transform currentResource assertNotNull copy toByteArray
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testImageThumbnail()
focal_class.declarator: log = LoggerFactory.getLogger(TransformerImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(TransformerImpl.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: handlers
focal_class.modifier: @Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policyOption = ReferencePolicyOption.GREEDY)
      private
focal_class.original_string: @Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policyOption = ReferencePolicyOption.GREEDY)
      private List<TransformationHandler> handlers;
focal_class.type: List<TransformationHandler>
focal_class.var_name: handlers
focal_class.declarator: thumbnailProviders
focal_class.modifier: @Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policyOption = ReferencePolicyOption.GREEDY)
      private
focal_class.original_string: @Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policyOption = ReferencePolicyOption.GREEDY)
      private List<ThumbnailProvider> thumbnailProviders;
focal_class.type: List<ThumbnailProvider>
focal_class.var_name: thumbnailProviders
focal_class.file: transformer/src/main/java/org/apache/sling/cms/transformer/internal/TransformerImpl.java
focal_class.identifier: TransformerImpl
focal_class.interfaces: implements Transformer
focal_class.class_method_signature: TransformerImpl.addThumbnailProvider(ThumbnailProvider thumbnailProvider)
focal_class.full_signature: public void addThumbnailProvider(ThumbnailProvider thumbnailProvider)
focal_class.identifier: addThumbnailProvider
focal_class.modifiers: public
focal_class.parameters: (ThumbnailProvider thumbnailProvider)
focal_class.return: void
focal_class.signature: void addThumbnailProvider(ThumbnailProvider thumbnailProvider)
focal_class.class_method_signature: TransformerImpl.addTransformationHandler(TransformationHandler handler)
focal_class.full_signature: public void addTransformationHandler(TransformationHandler handler)
focal_class.identifier: addTransformationHandler
focal_class.modifiers: public
focal_class.parameters: (TransformationHandler handler)
focal_class.return: void
focal_class.signature: void addTransformationHandler(TransformationHandler handler)
focal_class.class_method_signature: TransformerImpl.getHandlers()
focal_class.full_signature: public List<TransformationHandler> getHandlers()
focal_class.identifier: getHandlers
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<TransformationHandler>
focal_class.signature: List<TransformationHandler> getHandlers()
focal_class.class_method_signature: TransformerImpl.getThumbnailProvider(Resource resource)
focal_class.full_signature: private ThumbnailProvider getThumbnailProvider(Resource resource)
focal_class.identifier: getThumbnailProvider
focal_class.modifiers: private
focal_class.parameters: (Resource resource)
focal_class.return: ThumbnailProvider
focal_class.signature: ThumbnailProvider getThumbnailProvider(Resource resource)
focal_class.class_method_signature: TransformerImpl.getThumbnailProviders()
focal_class.full_signature: public List<ThumbnailProvider> getThumbnailProviders()
focal_class.identifier: getThumbnailProviders
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<ThumbnailProvider>
focal_class.signature: List<ThumbnailProvider> getThumbnailProviders()
focal_class.class_method_signature: TransformerImpl.getTransformationHandler(String resourceType)
focal_class.full_signature: public TransformationHandler getTransformationHandler(String resourceType)
focal_class.identifier: getTransformationHandler
focal_class.modifiers: public
focal_class.parameters: (String resourceType)
focal_class.return: TransformationHandler
focal_class.signature: TransformationHandler getTransformationHandler(String resourceType)
focal_class.class_method_signature: TransformerImpl.transform(Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
focal_class.full_signature: @Override public void transform(Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
focal_class.identifier: transform
focal_class.modifiers: @Override public
focal_class.parameters: (Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
focal_class.return: void
focal_class.signature: void transform(Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
focal_method.body: @Override
      public void transform(Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
              throws IOException {
          ThumbnailProvider provider = getThumbnailProvider(resource);
          log.debug("Using thumbnail provider {} for resource {}", provider, resource);
          Builder<? extends InputStream> builder = Thumbnails.of(provider.getThumbnail(resource));
          for (Resource config : transformation.getHandlers()) {
              log.debug("Handling command: {}", config);
              TransformationHandler handler = getTransformationHandler(config.getResourceType());
              if (handler != null) {
                  log.debug("Invoking handler {} for command {}", handler.getClass().getCanonicalName(),
                          config.getName());
                  handler.handle(builder, config);
              } else {
                  log.info("No handler found for: {}", config.getName());
              }
          }
          builder.outputFormat(format.toString());
          builder.toOutputStream(out);
  
      }
focal_method.class_method_signature: TransformerImpl.transform(Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
focal_method.full_signature: @Override public void transform(Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
focal_method.identifier: transform
focal_method.invocations: getThumbnailProvider debug of getThumbnail getHandlers debug getTransformationHandler getResourceType debug getCanonicalName getClass getName handle info getName outputFormat toString toOutputStream
focal_method.modifiers: @Override public
focal_method.parameters: (Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)
focal_method.return: void
focal_method.signature: void transform(Resource resource, Transformation transformation, OutputFileFormat format, OutputStream out)