Search in sources :

Example 16 with Path

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

the class DMNContentServiceImplTest method testGetPMMLModelsPaths.

@Test
public void testGetPMMLModelsPaths() {
    final Path path1 = mock(Path.class);
    final Path path2 = mock(Path.class);
    final List<Path> expectedPaths = asList(path1, path2);
    when(pathsHelper.getPMMLModelsPaths(workspaceProject)).thenReturn(expectedPaths);
    final List<Path> actualPaths = service.getPMMLModelsPaths(workspaceProject);
    assertEquals(expectedPaths, actualPaths);
}
Also used : Path(org.uberfire.backend.vfs.Path) Test(org.junit.Test)

Example 17 with Path

use of org.uberfire.backend.vfs.Path 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());
    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);
    verify(formEditorService, saveBeforeRenaming ? times(1) : never()).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) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition)

Example 18 with Path

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

the class FormEditorServiceImplTest method testCreateForm.

@Test
public void testCreateForm() {
    when(formDefinitionSerializer.serialize(any())).thenAnswer(this::verifyNewForm);
    FormModel formModel = mock(FormModel.class);
    Path resultPath = formEditorService.createForm(path, FULL_FORM_NAME, formModel);
    assertNotNull(resultPath);
}
Also used : Path(org.uberfire.backend.vfs.Path) DataObjectFormModel(org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel) FormModel(org.kie.workbench.common.forms.model.FormModel) Test(org.junit.Test)

Example 19 with Path

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

the class AbstractFormDefinitionHelperTest method testSupports.

@Test
public void testSupports() {
    Assertions.assertThat(helper.supports(originalPath)).isNotNull().isTrue();
    Path wrongPath = mock(Path.class);
    when(wrongPath.getFileName()).thenReturn("wrongh.path");
    Assertions.assertThat(helper.supports(wrongPath)).isNotNull().isFalse();
}
Also used : Path(org.uberfire.backend.vfs.Path) Test(org.junit.Test)

Example 20 with Path

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

the class MainDataObjectEditor method onNameChange.

@Override
public void onNameChange() {
    if (getDataObject() != null) {
        view.setNameOnError(false);
        final String packageName = getDataObject().getPackageName();
        final String oldValue = getDataObject().getName();
        final String newValue = view.getName();
        final String originalClassName = getContext() != null ? getContext().getEditorModelContent().getOriginalClassName() : null;
        final Path currentPath = getContext() != null && getContext().getEditorModelContent() != null ? getContext().getEditorModelContent().getPath() : null;
        if (originalClassName != null) {
            showAssetUsagesDisplayer.showAssetUsages(Constants.INSTANCE.modelEditor_confirm_renaming_of_used_class(originalClassName), currentPath, originalClassName, ResourceType.JAVA, () -> doClassNameChange(packageName, oldValue, newValue), () -> view.setName(oldValue));
        } else {
            doClassNameChange(packageName, oldValue, newValue);
        }
    }
}
Also used : Path(org.uberfire.backend.vfs.Path)

Aggregations

Path (org.uberfire.backend.vfs.Path)607 Test (org.junit.Test)408 URL (java.net.URL)93 Package (org.guvnor.common.services.project.model.Package)87 KieModuleService (org.kie.workbench.common.services.shared.project.KieModuleService)71 CreationalContext (javax.enterprise.context.spi.CreationalContext)66 Bean (javax.enterprise.inject.spi.Bean)66 ArrayList (java.util.ArrayList)63 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)51 Module (org.guvnor.common.services.project.model.Module)48 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)41 KieModule (org.kie.workbench.common.services.shared.project.KieModule)38 List (java.util.List)37 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)30 Branch (org.guvnor.structure.repositories.Branch)29 HashMap (java.util.HashMap)28 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)28 ObservablePath (org.uberfire.backend.vfs.ObservablePath)27 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)25 Before (org.junit.Before)25