use of org.pentaho.platform.api.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.api.repository2.unified.webservices.StringKeyStringValueDto in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryWebService method getFileMetadata.
@Override
public List<StringKeyStringValueDto> getFileMetadata(final String fileId) {
final Map<String, Serializable> metadataMap = repo.getFileMetadata(fileId);
final List<StringKeyStringValueDto> fileMetadataMap = new ArrayList<StringKeyStringValueDto>(metadataMap.size());
for (final String key : metadataMap.keySet()) {
fileMetadataMap.add(new StringKeyStringValueDto(key, metadataMap.get(key).toString()));
}
return fileMetadataMap;
}
use of org.pentaho.platform.api.repository2.unified.webservices.StringKeyStringValueDto in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryWebService method setFileMetadata.
@Override
public void setFileMetadata(final String fileId, final List<StringKeyStringValueDto> fileMetadataMap) {
Map<String, Serializable> metadataMap = new HashMap<String, Serializable>(fileMetadataMap.size());
for (final StringKeyStringValueDto dto : fileMetadataMap) {
metadataMap.put(dto.getKey(), dto.getValue());
}
repo.setFileMetadata(fileId, metadataMap);
}
Aggregations