use of org.guvnor.common.services.shared.metadata.model.Metadata in project drools-wb by kiegroup.
the class ScenarioSimulationServiceImplTest method saveAndRename.
@Test
public void saveAndRename() {
final Metadata metadata = mock(Metadata.class);
final ScenarioSimulationModel model = new ScenarioSimulationModel();
service.saveAndRename(path, "newName.scesim", metadata, model, "comment");
verify(saveAndRenameServiceMock).saveAndRename(path, "newName.scesim", metadata, model, "comment");
}
use of org.guvnor.common.services.shared.metadata.model.Metadata in project drools-wb by kiegroup.
the class DecisionTableXLSToDecisionTableGuidedConverter method createNewImports.
private void createNewImports(final Path context, final List<Import> imports, final ConversionResult result) {
if (imports == null || imports.isEmpty()) {
return;
}
// Get Module's project.imports path
final KieModule module = moduleService.resolveModule(context);
final Path externalImportsPath = module.getImportsPath();
// Load existing PackageImports
final ProjectImports projectImports = loadProjectImports(externalImportsPath);
// Make collections of existing Imports so we don't duplicate them when adding the new
List<String> existingImports = new ArrayList<>();
for (org.kie.soup.project.datamodel.imports.Import item : projectImports.getImports().getImports()) {
existingImports.add(item.getType());
}
// Add imports
boolean isModified = false;
for (Import item : imports) {
if (!existingImports.contains(item.getClassName())) {
isModified = true;
result.addMessage("Created Import for '" + item.getClassName() + "'.", ConversionMessageType.INFO);
projectImports.getImports().addImport(new org.kie.soup.project.datamodel.imports.Import(item.getClassName()));
}
}
// Save update
if (isModified) {
final Metadata metadata = metadataService.getMetadata(context);
importsService.save(externalImportsPath, projectImports, metadata, "Imports added during XLS conversion");
}
}
use of org.guvnor.common.services.shared.metadata.model.Metadata in project drools-wb by kiegroup.
the class DSLTextEditorServiceImplTest 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 String content = "content";
final String comment = "comment";
service.saveAndRename(path, newFileName, metadata, content, comment);
verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);
}
use of org.guvnor.common.services.shared.metadata.model.Metadata in project drools-wb by kiegroup.
the class DRLTextEditorServiceImplTest method testSave.
@Test
public void testSave() throws Exception {
final String ruleContent = "rule \"empty\" when then";
final String creationComment = "initial version";
final Metadata metadata = mock(Metadata.class);
when(metadataService.setUpAttributes(path, metadata)).thenReturn(Collections.EMPTY_MAP);
when(commentedOptionFactory.makeCommentedOption(creationComment)).thenReturn(commentedOption);
drlService.save(path, ruleContent, metadata, creationComment);
verify(ioService).write(any(org.uberfire.java.nio.file.Path.class), eq(ruleContent), eq(Collections.EMPTY_MAP), eq(commentedOption));
}
use of org.guvnor.common.services.shared.metadata.model.Metadata in project drools-wb by kiegroup.
the class GuidedRuleTemplateEditorServiceImplTest 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 TemplateModel content = mock(TemplateModel.class);
final String comment = "comment";
service.saveAndRename(path, newFileName, metadata, content, comment);
verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);
}
Aggregations