Search in sources :

Example 36 with IContentItem

use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.

the class HttpServletRequestHandler method handleUIRequest.

public void handleUIRequest(final IUIComponent component, final String contentType) throws IOException {
    IContentItem contentItem = getOutputHandler().getOutputContentItem(IOutputHandler.RESPONSE, IOutputHandler.CONTENT, getInstanceId(), null);
    OutputStream outputStream = contentItem.getOutputStream(this.getActionPath());
    ((BaseUIComponent) component).setUrlFactory(urlFactory);
    component.handleRequest(outputStream, this, contentType, getParameterProviders());
}
Also used : BaseUIComponent(org.pentaho.platform.uifoundation.component.BaseUIComponent) OutputStream(java.io.OutputStream) IContentItem(org.pentaho.platform.api.repository.IContentItem)

Example 37 with IContentItem

use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.

the class ApacheVFSOutputHandlerTest method getOutputContentItemTest.

@Test
public void getOutputContentItemTest() {
    setupMockObjectsDefaults(CONTENT_NAME, true, true);
    IContentItem contentItem = apacheVFSOutputHandler.getFileOutputContentItem();
    assertNotNull(contentItem);
}
Also used : IContentItem(org.pentaho.platform.api.repository.IContentItem) Test(org.junit.Test)

Example 38 with IContentItem

use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.

the class ApacheVFSOutputHandlerTest method getOutputContentFileNotWritableTest.

@Test
public void getOutputContentFileNotWritableTest() {
    setupMockObjectsDefaults(CONTENT_NAME, false, true);
    IContentItem contentItem = apacheVFSOutputHandler.getFileOutputContentItem();
    assertNull(contentItem);
    verify(apacheVFSOutputHandler).logError("Cannot write to virtal file: 1:filecontent");
}
Also used : IContentItem(org.pentaho.platform.api.repository.IContentItem) Test(org.junit.Test)

Example 39 with IContentItem

use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.

the class XActionUtilTest method testDeleteContentItem_repoNoFile.

@Test
public void testDeleteContentItem_repoNoFile() throws Exception {
    doReturn(null).when(repository).getFile(anyString());
    IContentItem item = mock(RepositoryFileContentItem.class);
    doReturn(mock(OutputStream.class)).when(item).getOutputStream(anyObject());
    XactionUtil.deleteContentItem(item, repository);
    verify(repository, times(0)).deleteFile(anyString(), anyBoolean(), anyString());
}
Also used : OutputStream(java.io.OutputStream) IContentItem(org.pentaho.platform.api.repository.IContentItem) Test(org.junit.Test)

Example 40 with IContentItem

use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.

the class XActionUtilTest method testDeleteContentItem_repo.

@Test
public void testDeleteContentItem_repo() throws Exception {
    IContentItem item = mock(RepositoryFileContentItem.class);
    doReturn(mock(OutputStream.class)).when(item).getOutputStream(anyObject());
    XactionUtil.deleteContentItem(item, repository);
    verify(repository, times(1)).deleteFile(anyString(), anyBoolean(), anyString());
}
Also used : OutputStream(java.io.OutputStream) IContentItem(org.pentaho.platform.api.repository.IContentItem) Test(org.junit.Test)

Aggregations

IContentItem (org.pentaho.platform.api.repository.IContentItem)49 OutputStream (java.io.OutputStream)20 Test (org.junit.Test)8 IActionParameter (org.pentaho.platform.api.engine.IActionParameter)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 SimpleOutputHandler (org.pentaho.platform.engine.core.output.SimpleOutputHandler)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 Iterator (java.util.Iterator)5 List (java.util.List)5 Element (org.dom4j.Element)5 SimpleContentItem (org.pentaho.platform.engine.core.output.SimpleContentItem)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 Document (org.dom4j.Document)4 IPentahoResultSet (org.pentaho.commons.connection.IPentahoResultSet)4 IRuntimeContext (org.pentaho.platform.api.engine.IRuntimeContext)4 InvalidParameterException (org.pentaho.platform.api.engine.InvalidParameterException)4 Set (java.util.Set)3 IActionSequenceResource (org.pentaho.platform.api.engine.IActionSequenceResource)3