Search in sources :

Example 1 with LockInfo

use of org.uberfire.backend.vfs.impl.LockInfo in project kie-wb-common by kiegroup.

the class MetadataWidgetTest method lockStatusTextLockedByOtherUser.

@Test
public void lockStatusTextLockedByOtherUser() {
    final String lockedBy = "Michael";
    final String expected = MetadataConstants.INSTANCE.LockedByHint() + " " + lockedBy;
    final String lockStatusText = metadataWidget.getLockStatusText(new LockInfo(true, lockedBy, null));
    assertEquals("Lock status text incorrect", expected, lockStatusText);
}
Also used : LockInfo(org.uberfire.backend.vfs.impl.LockInfo) Test(org.junit.Test)

Example 2 with LockInfo

use of org.uberfire.backend.vfs.impl.LockInfo in project kie-wb-common by kiegroup.

the class OverviewWidgetPresenterTest method testLockChangeDoesNotReloadAllMetadata.

@Test
public void testLockChangeDoesNotReloadAllMetadata() {
    final Path testPath = PathFactory.newPath("test", "uri");
    final Metadata metadata = mock(Metadata.class);
    when(metadata.getPath()).thenReturn(testPath);
    overview.setMetadata(metadata);
    editor.setContent(overview, mock(ObservablePath.class));
    verify(view, times(1)).setMetadata(any(Metadata.class), any(boolean.class));
    // Verify that we only update the lock status but leave the rest of the metadata unchanged
    final LockInfo lockInfo = new LockInfo(true, "christian", testPath);
    editor.onLockChange(lockInfo);
    verify(view, times(1)).setLockStatus(lockInfo);
    verify(view, times(1)).setMetadata(any(Metadata.class), any(boolean.class));
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) LockInfo(org.uberfire.backend.vfs.impl.LockInfo) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 3 with LockInfo

use of org.uberfire.backend.vfs.impl.LockInfo in project kie-wb-common by kiegroup.

the class MetadataWidgetTest method lockStatusTextNotLocked.

@Test
public void lockStatusTextNotLocked() {
    final String expected = MetadataConstants.INSTANCE.UnlockedHint();
    final String lockStatusText = metadataWidget.getLockStatusText(new LockInfo(false, "", null));
    assertEquals("Lock status text incorrect", expected, lockStatusText);
}
Also used : LockInfo(org.uberfire.backend.vfs.impl.LockInfo) Test(org.junit.Test)

Example 4 with LockInfo

use of org.uberfire.backend.vfs.impl.LockInfo in project kie-wb-common by kiegroup.

the class MetadataWidgetTest method lockStatusTextLockedByCurrentUser.

@Test
public void lockStatusTextLockedByCurrentUser() {
    final String lockedBy = "Christian";
    final String expected = MetadataConstants.INSTANCE.LockedByHintOwned();
    final String lockStatusText = metadataWidget.getLockStatusText(new LockInfo(true, lockedBy, null));
    assertEquals("Lock status text incorrect", expected, lockStatusText);
}
Also used : LockInfo(org.uberfire.backend.vfs.impl.LockInfo) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 LockInfo (org.uberfire.backend.vfs.impl.LockInfo)4 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)1 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 Path (org.uberfire.backend.vfs.Path)1