use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorGraphDeleteHelperTest method checkRemoveReferencesWithoutDecisionTableGraphs.
@Test
public void checkRemoveReferencesWithoutDecisionTableGraphs() throws URISyntaxException {
final org.uberfire.java.nio.file.Path dtPath = mock(org.uberfire.java.nio.file.Path.class);
when(dtPath.getFileName()).thenReturn(mock(org.uberfire.java.nio.file.Path.class));
when(dtPath.toUri()).thenReturn(new URI("default://test/dtable." + dtableType.getSuffix()));
when(dtPath.getFileSystem()).thenReturn(fileSystem);
paths.add(dtPath);
when(path.getFileName()).thenReturn("dtable.gdst");
when(path.toURI()).thenReturn("default://test/dtable.gdst");
helper.postProcess(path);
verify(helper, never()).updateGraphReferences(any(Path.class), any(Path.class));
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorServiceImplCDITest method testUndeclaredFunction.
@Test
@Ignore("RHDM-329")
public void testUndeclaredFunction() throws Exception {
final Path path = getPath("rhba370/src/main/resources/com/sample/dtissuesampleproject/UseUndeclaredFunction.gdst");
final List<ValidationMessage> validationMessages = testedService.validate(path, testedService.load(path));
Assertions.assertThat(validationMessages).hasSize(1);
Assertions.assertThat(validationMessages).extracting("text", String.class).allMatch(text -> text.contains("[KBase: defaultKieBase]: Unable to Analyse Expression isNotEmptyUndeclaredFunction(userCode)"));
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorServiceImplCDITest method testFunctionFromDrl.
@Test
public void testFunctionFromDrl() throws Exception {
final Path path = getPath("rhba370/src/main/resources/com/sample/dtissuesampleproject/UseFunctionFromDrl.gdst");
final List<ValidationMessage> validationMessages = testedService.validate(path, testedService.load(path));
Assertions.assertThat(validationMessages).isEmpty();
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorServiceImplTest method checkCreate.
@Test
public void checkCreate() {
final Path context = mock(Path.class);
final String fileName = "filename." + dtType.getSuffix();
final GuidedDecisionTable52 content = new GuidedDecisionTable52();
final String comment = "comment";
when(context.toURI()).thenReturn("default://project/src/main/resources/mypackage");
final Path p = service.create(context, fileName, content, comment);
verify(ioService, times(1)).write(any(org.uberfire.java.nio.file.Path.class), any(String.class), any(CommentedOption.class));
assertTrue(p.toURI().contains("src/main/resources/mypackage/filename." + dtType.getSuffix()));
assertEquals("mypackage", content.getPackageName());
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorServiceImplTest method checkLoad.
@Test
public void checkLoad() {
final Path path = mock(Path.class);
when(path.toURI()).thenReturn("default://project/src/main/resources/mypackage/dtable.gdst");
when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn("");
final GuidedDecisionTable52 model = service.load(path);
verify(ioService, times(1)).readAllString(any(org.uberfire.java.nio.file.Path.class));
assertNotNull(model);
}
Aggregations