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);
}
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);
}
Aggregations