use of org.uberfire.java.nio.base.options.CommentedOption in project kie-wb-common by kiegroup.
the class AbstractVFSDiagramService method saveOrUpdateSvg.
@Override
public Path saveOrUpdateSvg(Path diagramPath, String rawDiagramSvg) {
final org.uberfire.java.nio.file.Path svgPath = getDiagramSvgFilePath(getDiagramByPath(diagramPath));
LOG.info("Saving diagram SVG " + svgPath);
getIoService().write(svgPath, rawDiagramSvg, new CommentedOption(identity.getIdentifier()));
return convertToBackendPath(svgPath);
}
use of org.uberfire.java.nio.base.options.CommentedOption in project kie-wb-common by kiegroup.
the class ProjectDiagramServiceImplTest method testSaveAsXml.
@Test
public void testSaveAsXml() {
final String xml = "xml";
final String comment = "comment";
final Map<String, Object> attributes = Collections.singletonMap("key", "value");
final Path path = mock(Path.class);
final Metadata metadata = mock(Metadata.class);
final CommentedOption options = mock(CommentedOption.class);
when(metadataService.setUpAttributes(path, metadata)).thenReturn(attributes);
when(commentedOptionFactory.makeCommentedOption(comment)).thenReturn(options);
diagramService.saveAsXml(path, xml, metadata, comment);
verify(diagramServiceController, times(1)).saveAsXml(eq(path), eq(xml), eq(attributes), eq(options));
}
use of org.uberfire.java.nio.base.options.CommentedOption in project kie-wb-common by kiegroup.
the class ProjectDiagramServiceImplTest method testSave.
@Test
public void testSave() {
Metadata metadata = mock(Metadata.class);
String comment = "COMMENT";
Map<String, Object> attributes = Collections.singletonMap("key", "value");
CommentedOption options = mock(CommentedOption.class);
when(metadataService.setUpAttributes(path, metadata)).thenReturn(attributes);
when(commentedOptionFactory.makeCommentedOption(comment)).thenReturn(options);
when(diagramServiceController.save(path, diagram, attributes, options)).thenReturn(resultPath);
Path result = diagramService.save(path, diagram, metadata, comment);
verify(diagramServiceController, times(1)).save(path, diagram, attributes, options);
assertEquals(resultPath, result);
}
use of org.uberfire.java.nio.base.options.CommentedOption in project kie-wb-common by kiegroup.
the class ProjectDiagramServiceControllerTest method testSaveAsXml.
@Test
public void testSaveAsXml() {
final Path path = mock(Path.class);
final String xml = "xml";
final Map<String, ?> attributes = Collections.singletonMap("key", "value");
final CommentedOption option = mock(CommentedOption.class);
when(path.toURI()).thenReturn(FILE_URI);
final org.uberfire.java.nio.file.Path expectedNioPath = Paths.convert(path);
((ProjectDiagramServiceController) diagramService).saveAsXml(path, xml, attributes, option);
verify(ioService, times(1)).write(eq(expectedNioPath), eq(xml), eq(attributes), eq(option));
}
use of org.uberfire.java.nio.base.options.CommentedOption in project kie-wb-common by kiegroup.
the class BPMNVFSFormDefinitionGeneratorServiceTest method setup.
@Before
public void setup() throws IOException {
when(projectService.resolveModule(any())).thenReturn(module);
when(projectClassLoaderHelper.getModuleClassLoader(module)).thenReturn(this.getClass().getClassLoader());
source = mock(Path.class);
simpleFileSystemProvider = new SimpleFileSystemProvider();
simpleFileSystemProvider.forceAsDefault();
when(source.toURI()).thenReturn("default:///src/main/resources/test.frm");
when(commentedOptionFactory.makeCommentedOption(Mockito.<String>any())).then(invocationOnMock -> new CommentedOption("1", invocationOnMock.getArguments()[0].toString()));
formModelHandlerManager = new TestFormModelHandlerManager(projectService, projectClassLoaderHelper, fieldManager, modelFinderService);
when(modelReaderService.getModelReader(any())).thenReturn(modelReader);
service = new BPMNVFSFormDefinitionGeneratorService(fieldManager, modelReaderService, formModelHandlerManager, formFinderService, formSerializer, ioService, commentedOptionFactory, new FormModelSynchronizationUtilImpl(fieldManager, templateGenerator));
}
Aggregations