Search in sources :

Example 16 with StringKeyStringValueDto

use of org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto in project pentaho-platform by pentaho.

the class FileResourceTest method testDoGetMetadataError.

@Test
public void testDoGetMetadataError() throws Exception {
    Exception mockFileNotFoundException = mock(FileNotFoundException.class);
    doThrow(mockFileNotFoundException).when(fileResource.fileService).doGetMetadata(PATH_ID);
    Messages mockMessages = mock(Messages.class);
    doReturn(mockMessages).when(fileResource).getMessagesInstance();
    List<StringKeyStringValueDto> testList = fileResource.doGetMetadata(PATH_ID);
    assertNull(testList);
    verify(fileResource.fileService, times(1)).doGetMetadata(PATH_ID);
    verify(fileResource, times(1)).getMessagesInstance();
    verify(mockMessages, times(1)).getErrorString("FileResource.FILE_UNKNOWN", PATH_ID);
}
Also used : StringKeyStringValueDto(org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto) Messages(org.pentaho.platform.web.http.messages.Messages) GeneralSecurityException(java.security.GeneralSecurityException) InvalidParameterException(java.security.InvalidParameterException) PentahoAccessControlException(org.pentaho.platform.api.engine.PentahoAccessControlException) UnifiedRepositoryAccessDeniedException(org.pentaho.platform.api.repository2.unified.UnifiedRepositoryAccessDeniedException) FileNotFoundException(java.io.FileNotFoundException) WebApplicationException(javax.ws.rs.WebApplicationException) IllegalSelectorException(java.nio.channels.IllegalSelectorException) IOException(java.io.IOException) NoSuchBeanDefinitionException(org.springframework.beans.factory.NoSuchBeanDefinitionException) Test(org.junit.Test)

Example 17 with StringKeyStringValueDto

use of org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto in project pentaho-platform by pentaho.

the class UnifiedRepositoryToWebServiceAdapter method setFileMetadata.

@Override
public void setFileMetadata(final Serializable fileId, Map<String, Serializable> metadataMap) {
    Assert.notNull(fileId);
    Assert.notNull(metadataMap);
    List<StringKeyStringValueDto> fileMetadataMap = new ArrayList<StringKeyStringValueDto>(metadataMap.size());
    for (final String key : metadataMap.keySet()) {
        fileMetadataMap.add(new StringKeyStringValueDto(key, metadataMap.get(key).toString()));
    }
    repoWebService.setFileMetadata(fileId.toString(), fileMetadataMap);
}
Also used : StringKeyStringValueDto(org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto) ArrayList(java.util.ArrayList)

Aggregations

StringKeyStringValueDto (org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto)15 RepositoryFileDto (org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto)11 Test (org.junit.Test)9 FileNotFoundException (java.io.FileNotFoundException)7 GeneralSecurityException (java.security.GeneralSecurityException)7 ArrayList (java.util.ArrayList)7 Matchers.anyString (org.mockito.Matchers.anyString)6 IOException (java.io.IOException)4 Serializable (java.io.Serializable)4 IllegalSelectorException (java.nio.channels.IllegalSelectorException)4 InvalidParameterException (java.security.InvalidParameterException)4 Properties (java.util.Properties)4 PentahoAccessControlException (org.pentaho.platform.api.engine.PentahoAccessControlException)4 UnifiedRepositoryAccessDeniedException (org.pentaho.platform.api.repository2.unified.UnifiedRepositoryAccessDeniedException)4 RepositoryFileAclDto (org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 HashMap (java.util.HashMap)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 Response (javax.ws.rs.core.Response)2 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)2