Search in sources :

Example 1 with FileContentItem

use of org.pentaho.reporting.libraries.repository.file.FileContentItem in project pentaho-platform by pentaho.

the class PentahoURLRewriterTest method testRewriteRoot.

@Test
public void testRewriteRoot() throws Exception {
    String pattern = TEST_SRC + "/solution/test/reporting/system/{0}/param";
    PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
    File dataDirectory = new File("/");
    FileRepository dataRepository = new FileRepository(dataDirectory);
    File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
    File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
    ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
    ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
    String result = rewriter.rewrite(contentEntry, dataEntity);
    assertEquals(TEST_SRC + "/solution/test/reporting/system/dataEntityBackend/param", result);
}
Also used : FileRepository(org.pentaho.reporting.libraries.repository.file.FileRepository) FileContentItem(org.pentaho.reporting.libraries.repository.file.FileContentItem) ContentEntity(org.pentaho.reporting.libraries.repository.ContentEntity) File(java.io.File) Test(org.junit.Test)

Example 2 with FileContentItem

use of org.pentaho.reporting.libraries.repository.file.FileContentItem in project pentaho-platform by pentaho.

the class PentahoURLRewriterTest method testRewriteWithSimplePattern.

@Test
public void testRewriteWithSimplePattern() throws Exception {
    String pattern = TEST_SRC + "/solution/test/reporting/system";
    PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
    File dataDirectory = new File(TEST_SRC + "/solution/test/reporting/");
    FileRepository dataRepository = new FileRepository(dataDirectory);
    File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
    File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
    ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
    ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
    String result = rewriter.rewrite(contentEntry, dataEntity);
    assertEquals(pattern, result);
}
Also used : FileRepository(org.pentaho.reporting.libraries.repository.file.FileRepository) FileContentItem(org.pentaho.reporting.libraries.repository.file.FileContentItem) ContentEntity(org.pentaho.reporting.libraries.repository.ContentEntity) File(java.io.File) Test(org.junit.Test)

Example 3 with FileContentItem

use of org.pentaho.reporting.libraries.repository.file.FileContentItem in project pentaho-platform by pentaho.

the class PentahoURLRewriterTest method testRewriteWithPatternParam.

@Test
public void testRewriteWithPatternParam() throws Exception {
    String pattern = TEST_SRC + "/solution/test/reporting/system/{0}/param";
    PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
    File dataDirectory = new File(TEST_SRC + "/solution/test/reporting/");
    FileRepository dataRepository = new FileRepository(dataDirectory);
    File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
    File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
    ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
    ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
    String result = rewriter.rewrite(contentEntry, dataEntity);
    assertEquals(TEST_SRC + "/solution/test/reporting/system/dataEntityBackend/param", result);
}
Also used : FileRepository(org.pentaho.reporting.libraries.repository.file.FileRepository) FileContentItem(org.pentaho.reporting.libraries.repository.file.FileContentItem) ContentEntity(org.pentaho.reporting.libraries.repository.ContentEntity) File(java.io.File) Test(org.junit.Test)

Example 4 with FileContentItem

use of org.pentaho.reporting.libraries.repository.file.FileContentItem in project pentaho-platform by pentaho.

the class PentahoURLRewriterTest method testRewriteWithNullPattern.

@Test
public void testRewriteWithNullPattern() throws Exception {
    String pattern = null;
    PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
    File dataDirectory = new File(TEST_SRC + "/solution/test/reporting/");
    FileRepository dataRepository = new FileRepository(dataDirectory);
    File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
    File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
    ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
    ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
    String result = rewriter.rewrite(contentEntry, dataEntity);
    assertEquals("dataEntityBackend", result);
}
Also used : FileRepository(org.pentaho.reporting.libraries.repository.file.FileRepository) FileContentItem(org.pentaho.reporting.libraries.repository.file.FileContentItem) ContentEntity(org.pentaho.reporting.libraries.repository.ContentEntity) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)4 Test (org.junit.Test)4 ContentEntity (org.pentaho.reporting.libraries.repository.ContentEntity)4 FileContentItem (org.pentaho.reporting.libraries.repository.file.FileContentItem)4 FileRepository (org.pentaho.reporting.libraries.repository.file.FileRepository)4