private boolean extractGenerated() { final Map<String, Object> content = path.getAttrStorage().getContent(); final Object generatedFileAttribute = content.get(GENERATED_ATTRIBUTE_NAME); if (generatedFileAttribute instanceof Boolean) { return (Boolean) generatedFileAttribute; } return false; }
private boolean extractGenerated() { final Map<String, Object> content = path.getAttrStorage().getContent(); final Object generatedFileAttribute = content.get(GENERATED_ATTRIBUTE_NAME); if (generatedFileAttribute instanceof Boolean) { return (Boolean) generatedFileAttribute; } return false; }
public DiscussionView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent();
public DiscussionView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent();
public OtherMetaView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent();
public OtherMetaView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent();
private void readAttributesTest(final boolean generated) { AttrsStorage attrsStorage = mock(AttrsStorage.class); when(attrsStorage.getContent()).thenReturn(new HashMap<String, Object>() {{ put(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME, generated); }}); AbstractPath path = mock(AbstractPath.class); when(path.getAttrStorage()).thenReturn(attrsStorage); FileSystemProvider fileSystemProvider = mock(FileSystemProvider.class); BasicFileAttributeView basicFileAttributeView = mock(BasicFileAttributeView.class); when(basicFileAttributeView.readAttributes()).thenReturn(mock(BasicFileAttributes.class)); when(fileSystemProvider.getFileAttributeView(any(), any())).thenReturn(basicFileAttributeView); FileSystem fileSystem = mock(FileSystem.class); when(fileSystem.provider()).thenReturn(fileSystemProvider); when(path.getFileSystem()).thenReturn(fileSystem); GeneratedAttributesView view = new GeneratedAttributesView(path); GeneratedFileAttributes generatedFileAttributes = view.readAttributes(); assertEquals(generated, generatedFileAttributes.isGenerated()); } }
private void readAttributesTest(final boolean generated) { AttrsStorage attrsStorage = mock(AttrsStorage.class); when(attrsStorage.getContent()).thenReturn(new HashMap<String, Object>() {{ put(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME, generated); }}); AbstractPath path = mock(AbstractPath.class); when(path.getAttrStorage()).thenReturn(attrsStorage); FileSystemProvider fileSystemProvider = mock(FileSystemProvider.class); BasicFileAttributeView basicFileAttributeView = mock(BasicFileAttributeView.class); when(basicFileAttributeView.readAttributes()).thenReturn(mock(BasicFileAttributes.class)); when(fileSystemProvider.getFileAttributeView(any(), any())).thenReturn(basicFileAttributeView); FileSystem fileSystem = mock(FileSystem.class); when(fileSystem.provider()).thenReturn(fileSystemProvider); when(path.getFileSystem()).thenReturn(fileSystem); GeneratedAttributesView view = new GeneratedAttributesView(path); GeneratedFileAttributes generatedFileAttributes = view.readAttributes(); assertEquals(generated, generatedFileAttributes.isGenerated()); } }
@Override public <T extends BasicFileAttributes> T readAttributes() throws org.uberfire.java.nio.IOException { if (attrs == null) { final BasicFileAttributes basicAtts = ((BasicFileAttributeView) path.getAttrView(BasicFileAttributeView.class)).readAttributes(); attrs = new DublinCoreAttributes(basicAtts, (String) path.getAttrStorage().getContent().get("dcore.author")); } return (T) attrs; }
private void readAttributesTest(final boolean generated) { AttrsStorage attrsStorage = mock(AttrsStorage.class); when(attrsStorage.getContent()).thenReturn(new HashMap<String, Object>() {{ put(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME, generated); }}); AbstractPath path = mock(AbstractPath.class); when(path.getAttrStorage()).thenReturn(attrsStorage); FileSystemProvider fileSystemProvider = mock(FileSystemProvider.class); BasicFileAttributeView basicFileAttributeView = mock(BasicFileAttributeView.class); when(basicFileAttributeView.readAttributes()).thenReturn(mock(BasicFileAttributes.class)); when(fileSystemProvider.getFileAttributeView(any(), any())).thenReturn(basicFileAttributeView); FileSystem fileSystem = mock(FileSystem.class); when(fileSystem.provider()).thenReturn(fileSystemProvider); when(path.getFileSystem()).thenReturn(fileSystem); GeneratedAttributesView view = new GeneratedAttributesView(path); GeneratedFileAttributes generatedFileAttributes = view.readAttributes(); assertEquals(generated, generatedFileAttributes.isGenerated()); } }
@Override public <T extends BasicFileAttributes> T readAttributes() throws org.uberfire.java.nio.IOException { if (attrs == null) { final BasicFileAttributes basicAtts = ((BasicFileAttributeView) path.getAttrView(BasicFileAttributeView.class)).readAttributes(); attrs = new DublinCoreAttributes(basicAtts, (String) path.getAttrStorage().getContent().get("dcore.author")); } return (T) attrs; }
public DublinCoreView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent();