当前位置: 首页>>代码示例>>Java>>正文


Java MimeTypeService类代码示例

本文整理汇总了Java中org.apache.sling.commons.mime.MimeTypeService的典型用法代码示例。如果您正苦于以下问题:Java MimeTypeService类的具体用法?Java MimeTypeService怎么用?Java MimeTypeService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MimeTypeService类属于org.apache.sling.commons.mime包,在下文中一共展示了MimeTypeService类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
@Before
public void setup() throws PersistenceException {
    context.registerAdapter(ResourceResolver.class, AssetManager.class, new Function<ResourceResolver, AssetManager>() {
        @Nullable
        @Override
        public AssetManager apply(@Nullable ResourceResolver input) {
            return assetManager;
        }
    });

    context.create().resource("/content/dam", JcrConstants.JCR_PRIMARYTYPE, "sling:Folder");
    context.resourceResolver().commit();
    ingestor = new FileAssetIngestor(context.getService(MimeTypeService.class));
    ingestor.jcrBasePath = "/content/dam";
    ingestor.ignoreFileList = Collections.emptyList();
    ingestor.ignoreExtensionList = Collections.emptyList();
    ingestor.ignoreFolderList = Arrays.asList(".ds_store");
    ingestor.existingAssetAction = AssetIngestor.AssetAction.skip;

    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            CheckedConsumer<ResourceResolver> method = (CheckedConsumer<ResourceResolver>) invocation.getArguments()[0];
            method.accept(context.resourceResolver());
            return null;
        }
    }).when(actionManager).deferredWithResolver(any(CheckedConsumer.class));
    tempDirectory = Files.createTempDir();
    ingestor.fileBasePath = tempDirectory.getAbsolutePath();
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:31,代码来源:FileAssetIngestorTest.java

示例2: internalSetUp

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
protected static void internalSetUp(AemContext aemContext, String testBase) {
    CONTEXT.load().json(testBase + CoreComponentTestContext.TEST_CONTENT_JSON, TEST_CONTENT_ROOT);
    CONTEXT.load().json(testBase + CoreComponentTestContext.TEST_APPS_JSON, TEST_APPS_ROOT);
    mockedMimeTypeService = mock(MimeTypeService.class);
    when(mockedMimeTypeService.getMimeType("tif")).thenReturn(StandardImageHandler.TIFF_MIMETYPE);
    when(mockedMimeTypeService.getMimeType("tiff")).thenReturn(StandardImageHandler.TIFF_MIMETYPE);
    when(mockedMimeTypeService.getMimeType("png")).thenReturn(StandardImageHandler.PNG1_MIMETYPE);
    when(mockedMimeTypeService.getMimeType("jpg")).thenReturn(StandardImageHandler.JPEG_MIMETYPE);
    when(mockedMimeTypeService.getMimeType("jpeg")).thenReturn(StandardImageHandler.JPEG_MIMETYPE);
    when(mockedMimeTypeService.getMimeType("gif")).thenReturn(StandardImageHandler.GIF_MIMETYPE);
    when(mockedMimeTypeService.getExtension(StandardImageHandler.TIFF_MIMETYPE)).thenReturn("tiff");
    when(mockedMimeTypeService.getExtension(StandardImageHandler.JPEG_MIMETYPE)).thenReturn("jpeg");
    when(mockedMimeTypeService.getExtension(StandardImageHandler.PNG1_MIMETYPE)).thenReturn("png");
    when(mockedMimeTypeService.getExtension(StandardImageHandler.GIF_MIMETYPE)).thenReturn("gif");
    aemContext.load().json(testBase + "/test-conf.json", "/conf");
    aemContext.load().json("/image/test-content-dam.json", "/content/dam/core/images");
    aemContext.load().binaryFile("/image/" + PNG_IMAGE_BINARY_NAME, PNG_ASSET_PATH + "/jcr:content/renditions/original");
    aemContext.load().binaryFile("/image/" + "cq5dam.web.1280.1280_" + PNG_IMAGE_BINARY_NAME, PNG_ASSET_PATH +
            "/jcr:content/renditions/cq5dam.web.1280.1280.png");
    aemContext.load().binaryFile("/image/" + PNG_IMAGE_BINARY_NAME, PNG_ASSET_PATH_WITHOUT_EXTENSION + "/jcr:content/renditions/original");
    aemContext.load().binaryFile("/image/" + "cq5dam.web.1280.1280_" + PNG_IMAGE_BINARY_NAME, PNG_ASSET_PATH_WITHOUT_EXTENSION +
            "/jcr:content/renditions/cq5dam.web.1280.1280.png");
    aemContext.load().binaryFile("/image/" + GIF_IMAGE_BINARY_NAME, GIF_ASSET_PATH + "/jcr:content/renditions/original");
    aemContext.load().binaryFile("/image/" + "cq5dam.web.1280.1280_" + GIF_IMAGE_BINARY_NAME, GIF_ASSET_PATH +
            "/jcr:content/renditions/cq5dam.web.1280.1280.gif");
    aemContext.load().binaryFile("/image/" + GIF_IMAGE_BINARY_NAME, GIF5_FILE_PATH, StandardImageHandler.GIF_MIMETYPE);
    aemContext.load().binaryFile("/image/" + PNG_IMAGE_BINARY_NAME, PNG3_FILE_PATH, StandardImageHandler.PNG1_MIMETYPE);
    aemContext.load().binaryFile("/image/" + PNG_IMAGE_BINARY_NAME, PNG10_FILE_PATH, StandardImageHandler.PNG1_MIMETYPE);
    aemContext.load().binaryFile("/image/" + PNG_IMAGE_BINARY_NAME, PNG12_FILE_PATH, StandardImageHandler.PNG1_MIMETYPE);
    aemContext.load().binaryFile("/image/" + PNG_IMAGE_BINARY_NAME, PNG14_FILE_PATH, StandardImageHandler.PNG1_MIMETYPE);
    aemContext.load().binaryFile("/image/" + TIFF_IMAGE_BINARY_NAME, TIFF_ASSET_PATH + "/jcr:content/renditions/original");
    aemContext.load().binaryFile("/image/" + _1PX_IMAGE_BINARY_NAME, PNG20_FILE_PATH, StandardImageHandler.PNG1_MIMETYPE);
    aemContext.registerInjectActivateService(new MockAdapterFactory());
    contentPolicyManager = mock(ContentPolicyManager.class);
    aemContext.registerAdapter(ResourceResolver.class, ContentPolicyManager.class,
            new Function<ResourceResolver, ContentPolicyManager>() {
                @Nullable
                @Override
                public ContentPolicyManager apply(@Nullable ResourceResolver resolver) {
                    return contentPolicyManager;
                }
            });
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:44,代码来源:AbstractImageTest.java

示例3: bindMimeTypeService

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
protected void bindMimeTypeService(MimeTypeService var1) {
    this.mimeTypeService = var1;
}
 
开发者ID:Shashi-Bhushan,项目名称:General,代码行数:4,代码来源:RenditionMakerImpl.java

示例4: unbindMimeTypeService

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
protected void unbindMimeTypeService(MimeTypeService var1) {
    if(this.mimeTypeService == var1) {
        this.mimeTypeService = null;
    }

}
 
开发者ID:Shashi-Bhushan,项目名称:General,代码行数:7,代码来源:RenditionMakerImpl.java

示例5: FileAssetIngestor

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
public FileAssetIngestor(MimeTypeService mimeTypeService) {
    super(mimeTypeService);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:4,代码来源:FileAssetIngestor.java

示例6: AssetIngestor

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
public AssetIngestor(MimeTypeService mimeTypeService) {
    this.mimetypeService = mimeTypeService;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:4,代码来源:AssetIngestor.java

示例7: S3AssetIngestor

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
public S3AssetIngestor(MimeTypeService mimeTypeService) {
    super(mimeTypeService);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:4,代码来源:S3AssetIngestor.java

示例8: setup

import org.apache.sling.commons.mime.MimeTypeService; //导入依赖的package包/类
@Before
public void setup() throws PersistenceException {
    context.registerAdapter(ResourceResolver.class, AssetManager.class, new Function<ResourceResolver, AssetManager>() {
        @Nullable
        @Override
        public AssetManager apply(@Nullable ResourceResolver input) {
            return assetManager;
        }
    });

    context.create().resource("/content/dam", JcrConstants.JCR_PRIMARYTYPE, "sling:Folder");
    context.resourceResolver().commit();
    ingestor = new S3AssetIngestor(context.getService(MimeTypeService.class));
    ingestor.jcrBasePath = "/content/dam";
    ingestor.ignoreFileList = Collections.emptyList();
    ingestor.ignoreExtensionList = Collections.emptyList();
    ingestor.ignoreFolderList = Arrays.asList(".ds_store");
    ingestor.existingAssetAction = AssetIngestor.AssetAction.skip;

    int port = FreePortFinder.findFreeLocalPort();
    s3Mock = new S3Mock.Builder().withPort(port).withInMemoryBackend().build();
    s3Mock.start();

    S3ClientOptions options = S3ClientOptions.builder().setPathStyleAccess(true).build();
    s3Client = new AmazonS3Client(new AnonymousAWSCredentials());
    s3Client.setS3ClientOptions(options);
    s3Client.setEndpoint("http://localhost:" + port);
    ingestor.s3Client = s3Client;
    ingestor.bucket = TEST_BUCKET;

    s3Client.createBucket(TEST_BUCKET);

    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            CheckedConsumer<ResourceResolver> method = (CheckedConsumer<ResourceResolver>) invocation.getArguments()[0];
            method.accept(context.resourceResolver());
            return null;
        }
    }).when(actionManager).deferredWithResolver(any(CheckedConsumer.class));
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:42,代码来源:S3AssetIngestorTest.java


注:本文中的org.apache.sling.commons.mime.MimeTypeService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。