use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class DRLTextEditorServiceImplTest 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";
drlService.saveAndRename(path, newFileName, metadata, content, comment);
verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTableLockManagerImpl method fireChangeTitleEvent.
@Override
public void fireChangeTitleEvent() {
final Path path = getLockInfo().getFile();
if (path == null) {
return;
}
presenter.getActiveDecisionTable().ifPresent(dtPresenter -> {
final ObservablePath dtPath = dtPresenter.getCurrentPath();
if (dtPath == null) {
return;
}
if (dtPath.equals(path)) {
super.fireChangeTitleEvent();
}
});
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class NewGuidedDecisionTableHandlerTest method testResolvedHitPolicy.
@Test
public void testResolvedHitPolicy() throws Exception {
final Package pkg = mock(Package.class);
final Path resourcesPath = PathFactory.newPath("resources", "default://project/src/main/resources");
when(pkg.getPackageMainResourcesPath()).thenReturn(resourcesPath);
when(options.isUsingWizard()).thenReturn(false);
when(options.getHitPolicy()).thenReturn(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT);
handler.create(pkg, "fileName", newResourcePresenter);
final ArgumentCaptor<GuidedDecisionTable52> dtableArgumentCaptor = ArgumentCaptor.forClass(GuidedDecisionTable52.class);
verify(service, times(1)).create(eq(resourcesPath), eq("fileName." + resourceType.getSuffix()), dtableArgumentCaptor.capture(), any(String.class));
final GuidedDecisionTable52 model = dtableArgumentCaptor.getValue();
assertEquals(1, model.getMetadataCols().size());
final MetadataCol52 metadataCol52 = model.getMetadataCols().get(0);
assertEquals(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME, metadataCol52.getMetadata());
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTreeEditorServiceImpl method create.
@Override
public Path create(final Path context, final String fileName, final GuidedDecisionTree content, final String comment) {
try {
final Package pkg = moduleService.resolvePackage(context);
final String packageName = (pkg == null ? null : pkg.getPackageName());
content.setPackageName(packageName);
final org.uberfire.java.nio.file.Path nioPath = Paths.convert(context).resolve(fileName);
final Path newPath = Paths.convert(nioPath);
if (ioService.exists(nioPath)) {
throw new FileAlreadyExistsException(nioPath.toString());
}
ioService.write(nioPath, GuidedDecisionTreeDRLPersistence.getInstance().marshal(content), commentedOptionFactory.makeCommentedOption(comment));
return newPath;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTreeEditorServiceImplTest 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 GuidedDecisionTree content = mock(GuidedDecisionTree.class);
final String comment = "comment";
service.saveAndRename(path, newFileName, metadata, content, comment);
verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);
}
Aggregations