Java Code Examples for org.alfresco.repo.content.MimetypeMap#MIMETYPE_APPLICATION_PS

The following examples show how to use org.alfresco.repo.content.MimetypeMap#MIMETYPE_APPLICATION_PS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScriptNodeTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *  https://issues.alfresco.com/jira/browse/MNT-19682
 *  Test that mimetype is correctly set according to the content
 */
@Test
public void testWriteContentWithMimetypeAndWithoutFilename()
{
    createTestContent(true);
    ScriptNode scriptNode = new ScriptNode(testNode, SERVICE_REGISTRY);
    scriptNode.setScope(getScope());

    ScriptContentData scd = scriptNode.new ScriptContentData(null, ContentModel.PROP_CONTENT);

    InputStream inputStream = getClass().getClassLoader().getResourceAsStream(TEST_CONTENT_MODEL);
    InputStreamContent inputStreamContent = new InputStreamContent(inputStream, MimetypeMap.MIMETYPE_APPLICATION_PS, "UTF-8");

    scd.write(inputStreamContent, true, false);
    assertEquals(MimetypeMap.MIMETYPE_APPLICATION_PS, scriptNode.getMimetype());
}
 
Example 2
Source File: ScriptNodeTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *  https://issues.alfresco.com/jira/browse/MNT-19682
 *  Test that mimetype is correctly set according to the filename
 */
@Test
public void testWriteContentWithMimetypeAndFilename()
{
    createTestContent(true);
    ScriptNode scriptNode = new ScriptNode(testNode, SERVICE_REGISTRY);
    scriptNode.setScope(getScope());

    ScriptContentData scd = scriptNode.new ScriptContentData(null, ContentModel.PROP_CONTENT);

    InputStream inputStream = getClass().getClassLoader().getResourceAsStream(TEST_CONTENT_MODEL);
    InputStreamContent inputStreamContent = new InputStreamContent(inputStream, MimetypeMap.MIMETYPE_APPLICATION_PS, "UTF-8");

    scd.write(inputStreamContent, true, false, "test.ai");
    assertEquals(MimetypeMap.MIMETYPE_APPLICATION_ILLUSTRATOR, scriptNode.getMimetype());
}