use of org.pentaho.platform.api.engine.PentahoAccessControlException in project data-access by pentaho.
the class AnalysisResourceTest method testdeleteSchemaError.
@Test
public void testdeleteSchemaError() throws Exception {
Response mockResponse = mock(Response.class);
// Test 1
PentahoAccessControlException mockException = mock(PentahoAccessControlException.class);
doThrow(mockException).when(analysisResource.service).removeAnalysis("analysisId");
try {
Response response = analysisResource.deleteSchema("analysisId");
fail("should have gotten a WebApplicationException");
} catch (WebApplicationException e) {
// Good
}
verify(analysisResource, times(1)).deleteSchema("analysisId");
}
use of org.pentaho.platform.api.engine.PentahoAccessControlException 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");
}
use of org.pentaho.platform.api.engine.PentahoAccessControlException in project data-access by pentaho.
the class DataSourceWizardResourceTest method testDownloadError.
@Test
public void testDownloadError() throws Exception {
Response mockResponse = mock(Response.class);
// Test 1
PentahoAccessControlException mockPentahoAccessControlException = mock(PentahoAccessControlException.class);
doThrow(mockPentahoAccessControlException).when(dataSourceWizardResource.service).doGetDSWFilesAsDownload("dswId");
doReturn(mockResponse).when(dataSourceWizardResource).buildUnauthorizedResponse();
Response response = dataSourceWizardResource.downloadDsw("dswId");
assertEquals(mockResponse, response);
verify(dataSourceWizardResource, times(1)).downloadDsw("dswId");
}
Aggregations