Search in sources :

Example 21 with Metadata

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

the class GuidedScoreCardEditorServiceImplTest method testSaveAndRename.

@Test
public void testSaveAndRename() throws Exception {
    final Path path = mock(Path.class);
    final String newFileName = "newFileName";
    final Metadata metadata = mock(Metadata.class);
    final ScoreCardModel content = mock(ScoreCardModel.class);
    final String comment = "comment";
    service.saveAndRename(path, newFileName, metadata, content, comment);
    verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);
}
Also used : Path(org.uberfire.backend.vfs.Path) ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Test(org.junit.Test)

Example 22 with Metadata

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

the class FormEditorServiceImplTest method testRename.

private void testRename(boolean saveBeforeRenaming) {
    FormModelerContent content = mock(FormModelerContent.class);
    doReturn(path).when(formEditorService).save(any(Path.class), any(FormModelerContent.class), any(Metadata.class), anyString());
    doReturn(content).when(formEditorService).constructContent(any(Path.class), any(Overview.class));
    when(content.getDefinition()).thenReturn(mock(FormDefinition.class));
    Metadata metadata = mock(Metadata.class);
    FormModelerContent resultContent = formEditorService.rename(path, NEW_FORM_NAME, COMMIT_COMMENT, saveBeforeRenaming, content, metadata);
    assertSame(content, resultContent);
    VerificationMode constructContentCalls = saveBeforeRenaming ? never() : times(1);
    verify(formEditorService, constructContentCalls).constructContent(eq(path), any(Overview.class));
    verify(formEditorService).save(eq(path), eq(content), eq(metadata), eq(COMMIT_COMMENT));
    verify(renameService).rename(eq(path), eq(NEW_FORM_NAME), eq(COMMIT_COMMENT));
}
Also used : Path(org.uberfire.backend.vfs.Path) FormModelerContent(org.kie.workbench.common.forms.editor.model.FormModelerContent) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Overview(org.guvnor.common.services.shared.metadata.model.Overview) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) VerificationMode(org.mockito.verification.VerificationMode)

Example 23 with Metadata

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

the class DefaultEditorServiceImplTest method saveAndRename.

@Test
public void saveAndRename() throws Exception {
    final Path path = mock(Path.class);
    final Metadata metadata = mock(Metadata.class);
    final String newName = "newName";
    final String content = "content";
    final String comment = "comment";
    service.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) Test(org.junit.Test)

Example 24 with Metadata

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

the class PomEditorServiceImplTest method testSaveAndRename.

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

Example 25 with Metadata

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

the class PomEditorServiceImplTest method testSave.

@Test
public void testSave() {
    final Path path = mock(Path.class);
    final String content = "content";
    final Metadata metadata = mock(Metadata.class);
    final String comment = "comment";
    doReturn(path).when(service).save(path, content, metadata, comment, DeploymentMode.FORCED);
    service.save(path, content, metadata, comment);
    verify(service).save(path, content, metadata, comment, DeploymentMode.FORCED);
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) MavenRepositoryMetadata(org.guvnor.common.services.project.model.MavenRepositoryMetadata) Test(org.junit.Test)

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