use of org.pentaho.platform.api.repository.RepositoryException in project pentaho-platform by pentaho.
the class MondrianCatalogRepositoryHelper method includeAnnotatedSchema.
private Map<String, InputStream> includeAnnotatedSchema(final Map<String, InputStream> values) {
MondrianSchemaAnnotator annotator = PentahoSystem.get(MondrianSchemaAnnotator.class, ANNOTATOR_KEY, PentahoSessionHolder.getSession());
try {
if (annotator != null) {
byte[] schemaBytes = IOUtils.toByteArray(values.get(SCHEMA_XML));
byte[] annotationBytes = IOUtils.toByteArray(values.get(ANNOTATIONS_XML));
values.put(SCHEMA_XML, new ByteArrayInputStream(schemaBytes));
values.put(ANNOTATIONS_XML, new ByteArrayInputStream(annotationBytes));
values.put("schema.annotated.xml", annotator.getInputStream(new ByteArrayInputStream(schemaBytes), new ByteArrayInputStream(annotationBytes)));
}
} catch (IOException e) {
throw new RepositoryException(e);
}
return values;
}
use of org.pentaho.platform.api.repository.RepositoryException in project data-access by pentaho.
the class AnalysisResourceTest method testDoGetAnalysisFilesAsDownloadError.
@Test
public void testDoGetAnalysisFilesAsDownloadError() throws Exception {
// Test 1
PentahoAccessControlException mockException = mock(PentahoAccessControlException.class);
RepositoryException repositoryException = mock(RepositoryException.class);
doThrow(mockException).doThrow(repositoryException).when(analysisResource.service).doGetAnalysisFilesAsDownload("analysisId");
try {
Response response = analysisResource.downloadSchema("analysisId");
fail("Should have gotten a WebApplicationException");
} catch (WebApplicationException e) {
// Good
}
try {
Response response = analysisResource.downloadSchema("analysisId");
fail("Should have gotten a WebApplicationException");
} catch (WebApplicationException e) {
// Good
}
verify(analysisResource, times(2)).downloadSchema("analysisId");
}
Aggregations