use of org.uberfire.java.nio.base.options.CommentedOption in project kie-wb-common by kiegroup.
the class ProjectScreenModelSaverTest method testBatchSave.
@Test
public void testBatchSave() throws Exception {
final CommentedOption commentedOption = new CommentedOption("hello");
when(commentedOptionFactory.makeCommentedOption("message")).thenReturn(commentedOption);
saver.save(pathToPom, new ProjectScreenModel(), DeploymentMode.FORCED, "message");
verify(ioService).startBatch(any(FileSystem.class), eq(commentedOption));
verify(ioService).endBatch();
}
use of org.uberfire.java.nio.base.options.CommentedOption in project kie-wb-common by kiegroup.
the class DataModelerServiceTest method testSaveSource.
private void testSaveSource(String newPackageName, String newFileName, DataObject dataObject) {
Path dataObjectPath = PathFactory.newPath("TestDataObject", "file:///dataobjects/TestDataObject.java");
Path srcPath = PathFactory.newPath("src", "file:///src");
Package packageMock = mock(Package.class);
when(packageMock.getPackageMainSrcPath()).thenReturn(srcPath);
when(moduleService.resolvePackage(dataObjectPath)).thenReturn(packageMock);
when(packageMock.getPackageName()).thenReturn("dataobjects");
when(serviceHelper.ensurePackageStructure(Mockito.<Module>any(), Mockito.<String>any())).thenReturn(packageMock);
DataModelerSaveHelper saveHelper = mock(DataModelerSaveHelper.class);
List<DataModelerSaveHelper> saveHelpers = Arrays.asList(saveHelper);
when(saveHelperInstance.iterator()).thenReturn(saveHelpers.iterator());
dataModelerService.saveSource("Source", dataObjectPath, dataObject, mock(Metadata.class), "Commit message", newPackageName, newFileName);
verify(ioService, times(1)).startBatch(Mockito.<FileSystem>any());
if (newPackageName == null && newFileName == null) {
verify(ioService, times(1)).write(Mockito.<org.uberfire.java.nio.file.Path>any(), Mockito.<String>any(), Mockito.<Map>any(), Mockito.<CommentedOption>any());
} else if (newPackageName != null && newFileName != null) {
verify(ioService, times(1)).write(Mockito.<org.uberfire.java.nio.file.Path>any(), Mockito.<String>any(), Mockito.<Map>any(), Mockito.<CommentedOption>any());
verify(ioService, times(1)).move(Mockito.<org.uberfire.java.nio.file.Path>any(), Mockito.<org.uberfire.java.nio.file.Path>any(), Mockito.<CommentedOption>any());
} else if (newPackageName != null) {
verify(ioService, times(1)).write(Mockito.<org.uberfire.java.nio.file.Path>any(), Mockito.<String>any(), Mockito.<Map>any(), Mockito.<CommentedOption>any());
verify(ioService, times(1)).move(Mockito.<org.uberfire.java.nio.file.Path>any(), Mockito.<org.uberfire.java.nio.file.Path>any(), Mockito.<CommentedOption>any());
} else {
verify(renameService, times(1)).rename(Mockito.<Path>any(), Mockito.<String>any(), Mockito.<String>any());
}
verify(saveHelper, times(1)).postProcess(Mockito.<Path>any(), Mockito.<Path>any());
verify(ioService, times(1)).endBatch();
}
use of org.uberfire.java.nio.base.options.CommentedOption in project drools-wb by kiegroup.
the class ScoreCardXLSServiceImplTest method testSessionInfoOnCreate.
@Test
public void testSessionInfoOnCreate() {
service.create(path, inputstream, sessionId, comment);
final CommentedOption commentedOption = commentedOptionArgumentCaptor.getValue();
assertNotNull(commentedOption);
assertEquals("user", commentedOption.getName());
assertEquals("123", commentedOption.getSessionId());
}
use of org.uberfire.java.nio.base.options.CommentedOption in project drools-wb by kiegroup.
the class ScoreCardXLSServiceImplTest method testSessionInfoOnSave.
@Test
public void testSessionInfoOnSave() {
service.save(path, inputstream, sessionId, comment);
final CommentedOption commentedOption = commentedOptionArgumentCaptor.getValue();
assertNotNull(commentedOption);
assertEquals("user", commentedOption.getName());
assertEquals("123", commentedOption.getSessionId());
}
Aggregations