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);
}
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));
}
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);
}
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();
}
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);
}
}
}
Aggregations