Search in sources :

Example 1 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class DiscussionWidgetPresenterTest method testInit.

@Test
public void testInit() throws Exception {
    Metadata metadata = new Metadata();
    metadata.getDiscussion().add(new DiscussionRecord(1234, "Toni", "Knock Knock"));
    metadata.getDiscussion().add(new DiscussionRecord(1235, "Michael", "Who is there?"));
    metadata.getDiscussion().add(new DiscussionRecord(1236, "Toni", "Can't think of anything funny :("));
    DiscussionWidgetPresenter presenter = new DiscussionWidgetPresenter(view, identity, appConfigService);
    presenter.setContent(metadata);
    ArgumentCaptor<DiscussionRecord> discussionRecordArgumentCaptor = ArgumentCaptor.forClass(DiscussionRecord.class);
    verify(view, times(3)).addRow(discussionRecordArgumentCaptor.capture());
    assertComment(discussionRecordArgumentCaptor.getAllValues().get(0), 1234, "Toni", "Knock Knock");
    assertComment(discussionRecordArgumentCaptor.getAllValues().get(1), 1235, "Michael", "Who is there?");
    assertComment(discussionRecordArgumentCaptor.getAllValues().get(2), 1236, "Toni", "Can't think of anything funny :(");
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) DiscussionRecord(org.guvnor.common.services.shared.metadata.model.DiscussionRecord) DiscussionWidgetPresenter(org.kie.workbench.common.widgets.client.discussion.DiscussionWidgetPresenter) Test(org.junit.Test)

Example 2 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata 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 Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class ProjectImportsServiceImplTest method testSaveAndRename.

@Test
public void testSaveAndRename() {
    final Path path = mock(Path.class);
    final String newName = "newName";
    final Metadata metadata = mock(Metadata.class);
    final ProjectImports content = mock(ProjectImports.class);
    final String comment = "comment";
    projectImportsService.saveAndRename(path, newName, metadata, content, comment);
    verify(saveAndRenameService).saveAndRename(path, newName, metadata, content, comment);
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectImports(org.guvnor.common.services.project.model.ProjectImports) Test(org.junit.Test)

Example 4 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.

the class PackageNameWhiteListServiceImplTest method testSave.

@Test
public void testSave() throws Exception {
    final PackageNameWhiteListService service = makeService("");
    final Path path = mock(Path.class);
    final WhiteList whiteList = new WhiteList();
    final Metadata metadata = new Metadata();
    final String comment = "comment";
    service.save(path, whiteList, metadata, comment);
    verify(saver).save(path, whiteList, metadata, comment);
}
Also used : Path(org.uberfire.backend.vfs.Path) PackageNameWhiteListService(org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService) WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Test(org.junit.Test)

Example 5 with Metadata

use of org.guvnor.common.services.shared.metadata.model.Metadata in project drools-wb by kiegroup.

the class WorkItemsEditorServiceImpl method save.

@Override
public Path save(final Path resource, final String content, final Metadata metadata, final String comment) {
    try {
        Metadata currentMetadata = metadataService.getMetadata(resource);
        ioService.write(Paths.convert(resource), content, metadataService.setUpAttributes(resource, metadata), commentedOptionFactory.makeCommentedOption(comment));
        fireMetadataSocialEvents(resource, currentMetadata, metadata);
        return resource;
    } catch (Exception e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) FileAlreadyExistsException(org.uberfire.java.nio.file.FileAlreadyExistsException)

Aggregations

Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)62 Test (org.junit.Test)45 Path (org.uberfire.backend.vfs.Path)35 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)13 ProjectScreenModel (org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel)9 Package (org.guvnor.common.services.project.model.Package)7 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)6 HashMap (java.util.HashMap)5 POM (org.guvnor.common.services.project.model.POM)5 ProjectImports (org.guvnor.common.services.project.model.ProjectImports)5 ObservablePath (org.uberfire.backend.vfs.ObservablePath)5 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)5 Overview (org.guvnor.common.services.shared.metadata.model.Overview)4 WhiteList (org.kie.workbench.common.services.shared.whitelist.WhiteList)4 Map (java.util.Map)3 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)3 InvalidateDMOPackageCacheEvent (org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent)3 MavenRepositoryMetadata (org.guvnor.common.services.project.model.MavenRepositoryMetadata)3 KModuleModel (org.kie.workbench.common.services.shared.kmodule.KModuleModel)3 Mockito.anyString (org.mockito.Mockito.anyString)3