target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test @SuppressWarnings("unchecked") public void testExecute() { Collection<WorkItemDefinition> result = tested.execute(metadata); ArgumentCaptor<DirectoryStream.Filter> filterCaptor = ArgumentCaptor.forClass(DirectoryStream.Filter.class); verify(vfsService, times(1)) .newDirectoryStream(eq(path), any(DirectoryStream.Filter.class)); assertFalse(result.isEmpty()); assertEquals(1, result.size()); WorkItemDefinition wid = result.iterator().next(); assertEquals("Email", wid.getName()); } | @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return search(metadata); } | WorkItemDefinitionVFSLookupService implements WorkItemDefinitionService<Metadata> { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return search(metadata); } } | WorkItemDefinitionVFSLookupService implements WorkItemDefinitionService<Metadata> { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return search(metadata); } protected WorkItemDefinitionVFSLookupService(); @Inject WorkItemDefinitionVFSLookupService(final VFSService vfsService,
final WorkItemDefinitionResources resources); } | WorkItemDefinitionVFSLookupService implements WorkItemDefinitionService<Metadata> { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return search(metadata); } protected WorkItemDefinitionVFSLookupService(); @Inject WorkItemDefinitionVFSLookupService(final VFSService vfsService,
final WorkItemDefinitionResources resources); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); Collection<WorkItemDefinition> search(final Metadata metadata); Collection<WorkItemDefinition> search(final Metadata metadata,
final Path root); Collection<WorkItemDefinition> get(final Metadata metadata,
final Path resource); } | WorkItemDefinitionVFSLookupService implements WorkItemDefinitionService<Metadata> { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return search(metadata); } protected WorkItemDefinitionVFSLookupService(); @Inject WorkItemDefinitionVFSLookupService(final VFSService vfsService,
final WorkItemDefinitionResources resources); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); Collection<WorkItemDefinition> search(final Metadata metadata); Collection<WorkItemDefinition> search(final Metadata metadata,
final Path root); Collection<WorkItemDefinition> get(final Metadata metadata,
final Path resource); } |
@Test public void testDeploy() { tested.deploy(METADATA1); tested.deploy(METADATA2); tested.deploy(METADATA1); tested.deploy(METADATA2); verify(service1, times(1)).deploy(eq(METADATA1)); verify(service2, times(1)).deploy(eq(METADATA1)); verify(service1, times(1)).deploy(eq(METADATA2)); verify(service2, times(1)).deploy(eq(METADATA2)); } | @SuppressWarnings("all") public void deploy(final Metadata metadata) { final Path root = metadata.getRoot(); final Path deployedPath = getDeployedRoot(metadata); final Path path = null != deployedPath ? deployedPath : root; synchronized (path) { if (null == getDeployedRoot(metadata)) { deployed.put(root.toURI(), root); deployServices.forEach(s -> s.deploy(metadata)); } } } | WorkItemDefinitionDeployServices { @SuppressWarnings("all") public void deploy(final Metadata metadata) { final Path root = metadata.getRoot(); final Path deployedPath = getDeployedRoot(metadata); final Path path = null != deployedPath ? deployedPath : root; synchronized (path) { if (null == getDeployedRoot(metadata)) { deployed.put(root.toURI(), root); deployServices.forEach(s -> s.deploy(metadata)); } } } } | WorkItemDefinitionDeployServices { @SuppressWarnings("all") public void deploy(final Metadata metadata) { final Path root = metadata.getRoot(); final Path deployedPath = getDeployedRoot(metadata); final Path path = null != deployedPath ? deployedPath : root; synchronized (path) { if (null == getDeployedRoot(metadata)) { deployed.put(root.toURI(), root); deployServices.forEach(s -> s.deploy(metadata)); } } } protected WorkItemDefinitionDeployServices(); @Inject WorkItemDefinitionDeployServices(final @Any Instance<WorkItemDefinitionDeployService> deployServices); WorkItemDefinitionDeployServices(final Iterable<WorkItemDefinitionDeployService> deployServices,
final Map<String, Path> deployed); } | WorkItemDefinitionDeployServices { @SuppressWarnings("all") public void deploy(final Metadata metadata) { final Path root = metadata.getRoot(); final Path deployedPath = getDeployedRoot(metadata); final Path path = null != deployedPath ? deployedPath : root; synchronized (path) { if (null == getDeployedRoot(metadata)) { deployed.put(root.toURI(), root); deployServices.forEach(s -> s.deploy(metadata)); } } } protected WorkItemDefinitionDeployServices(); @Inject WorkItemDefinitionDeployServices(final @Any Instance<WorkItemDefinitionDeployService> deployServices); WorkItemDefinitionDeployServices(final Iterable<WorkItemDefinitionDeployService> deployServices,
final Map<String, Path> deployed); @SuppressWarnings("all") void deploy(final Metadata metadata); } | WorkItemDefinitionDeployServices { @SuppressWarnings("all") public void deploy(final Metadata metadata) { final Path root = metadata.getRoot(); final Path deployedPath = getDeployedRoot(metadata); final Path path = null != deployedPath ? deployedPath : root; synchronized (path) { if (null == getDeployedRoot(metadata)) { deployed.put(root.toURI(), root); deployServices.forEach(s -> s.deploy(metadata)); } } } protected WorkItemDefinitionDeployServices(); @Inject WorkItemDefinitionDeployServices(final @Any Instance<WorkItemDefinitionDeployService> deployServices); WorkItemDefinitionDeployServices(final Iterable<WorkItemDefinitionDeployService> deployServices,
final Map<String, Path> deployed); @SuppressWarnings("all") void deploy(final Metadata metadata); } |
@Test public void testDeployAssets() { ArgumentCaptor<Assets> assetsArgumentCaptor = ArgumentCaptor.forClass(Assets.class); tested.deploy(metadata); verify(backendFileSystemManager, times(1)) .deploy(eq(globalPath), assetsArgumentCaptor.capture(), anyString()); Collection<Asset> assets = assetsArgumentCaptor.getValue().getAssets(); assertEquals(WorkItemDefinitionDefaultDeployService.ASSETS.length, assets.size()); assertTrue(assets.contains(widAsset)); assertTrue(assets.contains(emailIcon)); assertTrue(assets.contains(brIcon)); assertTrue(assets.contains(decisionIcon)); assertTrue(assets.contains(logIcon)); assertTrue(assets.contains(serviceNodeIcon)); assertTrue(assets.contains(milestoneNodeIcon)); } | @Override public void deploy(final Metadata metadata) { backendFileSystemManager .deploy(resources.resolveGlobalPath(metadata), new Assets(Arrays.stream(ASSETS) .map(asset -> assetBuilder.apply(asset, ASSETS_ROOT + asset)) .collect(Collectors.toList())), DEPLOY_MESSAGE); } | WorkItemDefinitionDefaultDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { backendFileSystemManager .deploy(resources.resolveGlobalPath(metadata), new Assets(Arrays.stream(ASSETS) .map(asset -> assetBuilder.apply(asset, ASSETS_ROOT + asset)) .collect(Collectors.toList())), DEPLOY_MESSAGE); } } | WorkItemDefinitionDefaultDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { backendFileSystemManager .deploy(resources.resolveGlobalPath(metadata), new Assets(Arrays.stream(ASSETS) .map(asset -> assetBuilder.apply(asset, ASSETS_ROOT + asset)) .collect(Collectors.toList())), DEPLOY_MESSAGE); } protected WorkItemDefinitionDefaultDeployService(); @Inject WorkItemDefinitionDefaultDeployService(final WorkItemDefinitionResources resources,
final BackendFileSystemManager backendFileSystemManager); WorkItemDefinitionDefaultDeployService(final WorkItemDefinitionResources resources,
final BackendFileSystemManager backendFileSystemManager,
final BiFunction<String, String, Asset> assetBuilder); } | WorkItemDefinitionDefaultDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { backendFileSystemManager .deploy(resources.resolveGlobalPath(metadata), new Assets(Arrays.stream(ASSETS) .map(asset -> assetBuilder.apply(asset, ASSETS_ROOT + asset)) .collect(Collectors.toList())), DEPLOY_MESSAGE); } protected WorkItemDefinitionDefaultDeployService(); @Inject WorkItemDefinitionDefaultDeployService(final WorkItemDefinitionResources resources,
final BackendFileSystemManager backendFileSystemManager); WorkItemDefinitionDefaultDeployService(final WorkItemDefinitionResources resources,
final BackendFileSystemManager backendFileSystemManager,
final BiFunction<String, String, Asset> assetBuilder); @Override void deploy(final Metadata metadata); } | WorkItemDefinitionDefaultDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { backendFileSystemManager .deploy(resources.resolveGlobalPath(metadata), new Assets(Arrays.stream(ASSETS) .map(asset -> assetBuilder.apply(asset, ASSETS_ROOT + asset)) .collect(Collectors.toList())), DEPLOY_MESSAGE); } protected WorkItemDefinitionDefaultDeployService(); @Inject WorkItemDefinitionDefaultDeployService(final WorkItemDefinitionResources resources,
final BackendFileSystemManager backendFileSystemManager); WorkItemDefinitionDefaultDeployService(final WorkItemDefinitionResources resources,
final BackendFileSystemManager backendFileSystemManager,
final BiFunction<String, String, Asset> assetBuilder); @Override void deploy(final Metadata metadata); } |
@Test public void testParseJBPMWorkDefinition() { WorkItemDefinition workItemDefinition = WorkItemDefinitionParser.parse(jbpmWorkDefinition, w -> "uri", dataUriProvider); assertNotNull(workItemDefinition); assertEquals(NAME, workItemDefinition.getName()); assertEquals(CATWGORY, workItemDefinition.getCategory()); assertEquals(DESC, workItemDefinition.getDescription()); assertEquals(DISPLAY_NAME, workItemDefinition.getDisplayName()); assertEquals(DOC, workItemDefinition.getDocumentation()); assertEquals(HANDLER, workItemDefinition.getDefaultHandler()); assertEquals(ICON_DATA, workItemDefinition.getIconDefinition().getIconData()); assertEquals("|param1:String,param2:String|", workItemDefinition.getParameters()); assertEquals("||", workItemDefinition.getResults()); } | public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } static Collection<WorkItemDefinition> parse(final String content,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } static Collection<WorkItemDefinition> parse(final String content,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); static final Map<Class<?>, Function<Object, String>> DATA_TYPE_FORMATTERS; static final String ENCODING; } |
@Test public void testEmailWorkItemDefinition() throws Exception { when(dataUriProvider.apply(eq("email.gif"))).thenReturn(ICON_DATA); String raw = loadStream(WID_EMAIL); Collection<WorkItemDefinition> workItemDefinitions = WorkItemDefinitionParser.parse(raw, w -> "uri", dataUriProvider); assertNotNull(workItemDefinitions); assertEquals(1, workItemDefinitions.size()); WorkItemDefinition workItemDefinition = workItemDefinitions.iterator().next(); assertNotNull(workItemDefinition); assertEquals("Email", workItemDefinition.getName()); assertEquals("Communication", workItemDefinition.getCategory()); assertEquals("Sending emails", workItemDefinition.getDescription()); assertEquals("Email", workItemDefinition.getDisplayName()); assertEquals("index.html", workItemDefinition.getDocumentation()); assertEquals("org.jbpm.process.workitem.email.EmailWorkItemHandler", workItemDefinition.getDefaultHandler()); assertEquals(ICON_DATA, workItemDefinition.getIconDefinition().getIconData()); assertEquals("|Body:String,From:String,Subject:String,To:String|", workItemDefinition.getParameters()); assertEquals("||", workItemDefinition.getResults()); } | public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } static Collection<WorkItemDefinition> parse(final String content,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } static Collection<WorkItemDefinition> parse(final String content,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); static final Map<Class<?>, Function<Object, String>> DATA_TYPE_FORMATTERS; static final String ENCODING; } |
@Test public void testFTPWorkItemDefinition() throws Exception { when(dataUriProvider.apply(eq("ftp.gif"))).thenReturn(ICON_DATA); String raw = loadStream(WID_FTP); Collection<WorkItemDefinition> workItemDefinitions = WorkItemDefinitionParser.parse(raw, w -> "uri", dataUriProvider); assertNotNull(workItemDefinitions); assertEquals(1, workItemDefinitions.size()); WorkItemDefinition workItemDefinition = workItemDefinitions.iterator().next(); assertNotNull(workItemDefinition); assertEquals("FTP", workItemDefinition.getName()); assertEquals("File System", workItemDefinition.getCategory()); assertEquals("Sending files using FTP", workItemDefinition.getDescription()); assertEquals("FTP", workItemDefinition.getDisplayName()); assertEquals("", workItemDefinition.getDocumentation()); assertEquals("org.jbpm.process.workitem.ftp.FTPUploadWorkItemHandler", workItemDefinition.getDefaultHandler()); assertEquals(ICON_DATA, workItemDefinition.getIconDefinition().getIconData()); assertEquals("|Body:String,FilePath:String,Password:String,User:String|", workItemDefinition.getParameters()); assertEquals("||", workItemDefinition.getResults()); } | public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } static Collection<WorkItemDefinition> parse(final String content,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); } | WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } static Collection<WorkItemDefinition> parse(final String content,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
final Function<WorkDefinitionImpl, String> uriProvider,
final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); static final Map<Class<?>, Function<Object, String>> DATA_TYPE_FORMATTERS; static final String ENCODING; } |
@Test public void testProfile() { BPMNRuleFlowProjectProfile profile = new BPMNRuleFlowProjectProfile(); assertEquals(new BPMNRuleFlowProfile().getProfileId(), profile.getProfileId()); assertEquals(Profile.PLANNER_AND_RULES.getName(), profile.getProjectProfileName()); } | @Override public String getProjectProfileName() { return Profile.PLANNER_AND_RULES.getName(); } | BPMNRuleFlowProjectProfile extends BPMNRuleFlowProfile implements ProjectProfile { @Override public String getProjectProfileName() { return Profile.PLANNER_AND_RULES.getName(); } } | BPMNRuleFlowProjectProfile extends BPMNRuleFlowProfile implements ProjectProfile { @Override public String getProjectProfileName() { return Profile.PLANNER_AND_RULES.getName(); } } | BPMNRuleFlowProjectProfile extends BPMNRuleFlowProfile implements ProjectProfile { @Override public String getProjectProfileName() { return Profile.PLANNER_AND_RULES.getName(); } @Override String getProjectProfileName(); } | BPMNRuleFlowProjectProfile extends BPMNRuleFlowProfile implements ProjectProfile { @Override public String getProjectProfileName() { return Profile.PLANNER_AND_RULES.getName(); } @Override String getProjectProfileName(); } |
@Test public void testGetProcessIdResourceType() throws Exception { assertEquals(tested.getProcessIdResourceType(), ResourceType.BPMN2); } | @Override protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } | FindBpmnProcessIdsQuery extends AbstractFindIdsQuery { @Override protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } } | FindBpmnProcessIdsQuery extends AbstractFindIdsQuery { @Override protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } } | FindBpmnProcessIdsQuery extends AbstractFindIdsQuery { @Override protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } @Override String getName(); } | FindBpmnProcessIdsQuery extends AbstractFindIdsQuery { @Override protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } @Override String getName(); static final String NAME; } |
@Test public void build() { tested.build("uuid", "def", projectMetadata); verify(workItemDefinitionService).execute(projectMetadata); } | @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { workItemDefinitionService.execute(metadata); return super.build(uuid, definition); } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { workItemDefinitionService.execute(metadata); return super.build(uuid, definition); } } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { workItemDefinitionService.execute(metadata); return super.build(uuid, definition); } CaseGraphFactoryImpl(); @Inject CaseGraphFactoryImpl(DefinitionManager definitionManager, FactoryManager factoryManager,
RuleManager ruleManager, GraphCommandManager graphCommandManager,
GraphCommandFactory graphCommandFactory, GraphIndexBuilder<?> indexBuilder,
CustomTaskFactory customTaskFactory,
WorkItemDefinitionLookupService workItemDefinitionService); } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { workItemDefinitionService.execute(metadata); return super.build(uuid, definition); } CaseGraphFactoryImpl(); @Inject CaseGraphFactoryImpl(DefinitionManager definitionManager, FactoryManager factoryManager,
RuleManager ruleManager, GraphCommandManager graphCommandManager,
GraphCommandFactory graphCommandFactory, GraphIndexBuilder<?> indexBuilder,
CustomTaskFactory customTaskFactory,
WorkItemDefinitionLookupService workItemDefinitionService); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { workItemDefinitionService.execute(metadata); return super.build(uuid, definition); } CaseGraphFactoryImpl(); @Inject CaseGraphFactoryImpl(DefinitionManager definitionManager, FactoryManager factoryManager,
RuleManager ruleManager, GraphCommandManager graphCommandManager,
GraphCommandFactory graphCommandFactory, GraphIndexBuilder<?> indexBuilder,
CustomTaskFactory customTaskFactory,
WorkItemDefinitionLookupService workItemDefinitionService); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); } |
@Test public void testSetIcon() { final String iconURI = "http: icon.src = "something"; view.setIcon(iconURI); assertEquals(iconURI, icon.src); } | @Override public void setIcon(final String iconURI) { icon.src = iconURI; } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setIcon(final String iconURI) { icon.src = iconURI; } } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setIcon(final String iconURI) { icon.src = iconURI; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setIcon(final String iconURI) { icon.src = iconURI; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setIcon(final String iconURI) { icon.src = iconURI; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } |
@Test public void testGetNodesFromImportsWhenPathDoesNotRepresentsAnImportedDiagram() { final Path path = mock(Path.class); final DMNIncludedModel includedModel1 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel2 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel3 = mock(DMNIncludedModel.class); final List<DMNIncludedModel> imports = asList(includedModel1, includedModel2, includedModel3); when(includedModel1.getNamespace()).thenReturn(": when(includedModel2.getNamespace()).thenReturn(": when(includedModel3.getNamespace()).thenReturn(": when(diagramHelper.getDiagramByPath(path)).thenReturn(diagram); when(diagramHelper.getNamespace(diagram)).thenReturn(": final List<DMNIncludedNode> actualNodes = filter.getNodesFromImports(path, imports); final List<DMNIncludedNode> expectedNodes = emptyList(); assertEquals(expectedNodes, actualNodes); } | public List<DMNIncludedNode> getNodesFromImports(final Path path, final List<DMNIncludedModel> includedModels) { try { final Diagram<Graph, Metadata> diagram = diagramHelper.getDiagramByPath(path); final Optional<DMNIncludedModel> diagramImport = getDiagramImport(diagram, includedModels); return diagramImport .map(dmn -> diagramHelper .getNodes(diagram) .stream() .map(node -> factory.makeDMNIncludeModel(path, dmn, node)) .collect(Collectors.toList())) .orElse(new ArrayList<>()); } catch (final Exception e) { } return new ArrayList<>(); } | DMNIncludedNodesFilter { public List<DMNIncludedNode> getNodesFromImports(final Path path, final List<DMNIncludedModel> includedModels) { try { final Diagram<Graph, Metadata> diagram = diagramHelper.getDiagramByPath(path); final Optional<DMNIncludedModel> diagramImport = getDiagramImport(diagram, includedModels); return diagramImport .map(dmn -> diagramHelper .getNodes(diagram) .stream() .map(node -> factory.makeDMNIncludeModel(path, dmn, node)) .collect(Collectors.toList())) .orElse(new ArrayList<>()); } catch (final Exception e) { } return new ArrayList<>(); } } | DMNIncludedNodesFilter { public List<DMNIncludedNode> getNodesFromImports(final Path path, final List<DMNIncludedModel> includedModels) { try { final Diagram<Graph, Metadata> diagram = diagramHelper.getDiagramByPath(path); final Optional<DMNIncludedModel> diagramImport = getDiagramImport(diagram, includedModels); return diagramImport .map(dmn -> diagramHelper .getNodes(diagram) .stream() .map(node -> factory.makeDMNIncludeModel(path, dmn, node)) .collect(Collectors.toList())) .orElse(new ArrayList<>()); } catch (final Exception e) { } return new ArrayList<>(); } @Inject DMNIncludedNodesFilter(final DMNDiagramHelper diagramHelper,
final DMNIncludedNodeFactory factory); } | DMNIncludedNodesFilter { public List<DMNIncludedNode> getNodesFromImports(final Path path, final List<DMNIncludedModel> includedModels) { try { final Diagram<Graph, Metadata> diagram = diagramHelper.getDiagramByPath(path); final Optional<DMNIncludedModel> diagramImport = getDiagramImport(diagram, includedModels); return diagramImport .map(dmn -> diagramHelper .getNodes(diagram) .stream() .map(node -> factory.makeDMNIncludeModel(path, dmn, node)) .collect(Collectors.toList())) .orElse(new ArrayList<>()); } catch (final Exception e) { } return new ArrayList<>(); } @Inject DMNIncludedNodesFilter(final DMNDiagramHelper diagramHelper,
final DMNIncludedNodeFactory factory); List<DMNIncludedNode> getNodesFromImports(final Path path,
final List<DMNIncludedModel> includedModels); } | DMNIncludedNodesFilter { public List<DMNIncludedNode> getNodesFromImports(final Path path, final List<DMNIncludedModel> includedModels) { try { final Diagram<Graph, Metadata> diagram = diagramHelper.getDiagramByPath(path); final Optional<DMNIncludedModel> diagramImport = getDiagramImport(diagram, includedModels); return diagramImport .map(dmn -> diagramHelper .getNodes(diagram) .stream() .map(node -> factory.makeDMNIncludeModel(path, dmn, node)) .collect(Collectors.toList())) .orElse(new ArrayList<>()); } catch (final Exception e) { } return new ArrayList<>(); } @Inject DMNIncludedNodesFilter(final DMNDiagramHelper diagramHelper,
final DMNIncludedNodeFactory factory); List<DMNIncludedNode> getNodesFromImports(final Path path,
final List<DMNIncludedModel> includedModels); } |
@Test @SuppressWarnings("all") public void buildInitialisationCommands() { final List<Command> commands = tested.buildInitialisationCommands(); assertEquals(1, commands.size()); final AddNodeCommand addNodeCommand = (AddNodeCommand) commands.get(0); assertEquals(addNodeCommand.getCandidate(), diagramNode); } | @Override protected List<Command> buildInitialisationCommands() { final List<Command> commands = new ArrayList<>(); final Node<Definition<BPMNDiagram>, Edge> diagramNode = (Node<Definition<BPMNDiagram>, Edge>) factoryManager.newElement(UUID.uuid(), getDefinitionId(getDiagramType())); commands.add(graphCommandFactory.addNode(diagramNode)); final AdHoc adHoc = diagramNode.getContent().getDefinition().getDiagramSet().getAdHoc(); adHoc.setValue(true); return commands; } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override protected List<Command> buildInitialisationCommands() { final List<Command> commands = new ArrayList<>(); final Node<Definition<BPMNDiagram>, Edge> diagramNode = (Node<Definition<BPMNDiagram>, Edge>) factoryManager.newElement(UUID.uuid(), getDefinitionId(getDiagramType())); commands.add(graphCommandFactory.addNode(diagramNode)); final AdHoc adHoc = diagramNode.getContent().getDefinition().getDiagramSet().getAdHoc(); adHoc.setValue(true); return commands; } } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override protected List<Command> buildInitialisationCommands() { final List<Command> commands = new ArrayList<>(); final Node<Definition<BPMNDiagram>, Edge> diagramNode = (Node<Definition<BPMNDiagram>, Edge>) factoryManager.newElement(UUID.uuid(), getDefinitionId(getDiagramType())); commands.add(graphCommandFactory.addNode(diagramNode)); final AdHoc adHoc = diagramNode.getContent().getDefinition().getDiagramSet().getAdHoc(); adHoc.setValue(true); return commands; } CaseGraphFactoryImpl(); @Inject CaseGraphFactoryImpl(DefinitionManager definitionManager, FactoryManager factoryManager,
RuleManager ruleManager, GraphCommandManager graphCommandManager,
GraphCommandFactory graphCommandFactory, GraphIndexBuilder<?> indexBuilder,
CustomTaskFactory customTaskFactory,
WorkItemDefinitionLookupService workItemDefinitionService); } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override protected List<Command> buildInitialisationCommands() { final List<Command> commands = new ArrayList<>(); final Node<Definition<BPMNDiagram>, Edge> diagramNode = (Node<Definition<BPMNDiagram>, Edge>) factoryManager.newElement(UUID.uuid(), getDefinitionId(getDiagramType())); commands.add(graphCommandFactory.addNode(diagramNode)); final AdHoc adHoc = diagramNode.getContent().getDefinition().getDiagramSet().getAdHoc(); adHoc.setValue(true); return commands; } CaseGraphFactoryImpl(); @Inject CaseGraphFactoryImpl(DefinitionManager definitionManager, FactoryManager factoryManager,
RuleManager ruleManager, GraphCommandManager graphCommandManager,
GraphCommandFactory graphCommandFactory, GraphIndexBuilder<?> indexBuilder,
CustomTaskFactory customTaskFactory,
WorkItemDefinitionLookupService workItemDefinitionService); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); } | CaseGraphFactoryImpl extends BPMNGraphFactoryImpl { @Override protected List<Command> buildInitialisationCommands() { final List<Command> commands = new ArrayList<>(); final Node<Definition<BPMNDiagram>, Edge> diagramNode = (Node<Definition<BPMNDiagram>, Edge>) factoryManager.newElement(UUID.uuid(), getDefinitionId(getDiagramType())); commands.add(graphCommandFactory.addNode(diagramNode)); final AdHoc adHoc = diagramNode.getContent().getDefinition().getDiagramSet().getAdHoc(); adHoc.setValue(true); return commands; } CaseGraphFactoryImpl(); @Inject CaseGraphFactoryImpl(DefinitionManager definitionManager, FactoryManager factoryManager,
RuleManager ruleManager, GraphCommandManager graphCommandManager,
GraphCommandFactory graphCommandFactory, GraphIndexBuilder<?> indexBuilder,
CustomTaskFactory customTaskFactory,
WorkItemDefinitionLookupService workItemDefinitionService); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); } |
@Test public void setDiagramType() { tested.setDiagramType(BPMNDiagramImpl.class); verify(bpmnGraphFactory).setDiagramType(BPMNDiagramImpl.class); verify(caseGraphFactory).setDiagramType(BPMNDiagramImpl.class); } | @Override public void setDiagramType(Class<? extends BPMNDiagram> diagramType) { bpmnGraphFactory.setDiagramType(diagramType); caseGraphFactory.setDiagramType(diagramType); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public void setDiagramType(Class<? extends BPMNDiagram> diagramType) { bpmnGraphFactory.setDiagramType(diagramType); caseGraphFactory.setDiagramType(diagramType); } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public void setDiagramType(Class<? extends BPMNDiagram> diagramType) { bpmnGraphFactory.setDiagramType(diagramType); caseGraphFactory.setDiagramType(diagramType); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public void setDiagramType(Class<? extends BPMNDiagram> diagramType) { bpmnGraphFactory.setDiagramType(diagramType); caseGraphFactory.setDiagramType(diagramType); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public void setDiagramType(Class<? extends BPMNDiagram> diagramType) { bpmnGraphFactory.setDiagramType(diagramType); caseGraphFactory.setDiagramType(diagramType); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void getFactoryType() { assertEquals(tested.getFactoryType(), BPMNGraphFactory.class); } | @Override public Class<? extends ElementFactory> getFactoryType() { return BPMNGraphFactory.class; } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Class<? extends ElementFactory> getFactoryType() { return BPMNGraphFactory.class; } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Class<? extends ElementFactory> getFactoryType() { return BPMNGraphFactory.class; } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Class<? extends ElementFactory> getFactoryType() { return BPMNGraphFactory.class; } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Class<? extends ElementFactory> getFactoryType() { return BPMNGraphFactory.class; } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void buildCase() { when(projectMetadata.getProjectType()).thenReturn(ProjectType.CASE.name()); tested.build(GRAPH_UUID, DEFINITION, projectMetadata); verify(caseGraphFactory).build(GRAPH_UUID, DEFINITION, projectMetadata); verify(bpmnGraphFactory, never()).build(GRAPH_UUID, DEFINITION, projectMetadata); } | @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void buildBPMN() { when(projectMetadata.getProjectType()).thenReturn(ProjectType.BPMN.name()); tested.build(GRAPH_UUID, DEFINITION, projectMetadata); verify(caseGraphFactory, never()).build(GRAPH_UUID, DEFINITION, projectMetadata); verify(bpmnGraphFactory).build(GRAPH_UUID, DEFINITION, projectMetadata); } | @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void buildDefault() { tested.build(GRAPH_UUID, DEFINITION, projectMetadata); verify(caseGraphFactory, never()).build(GRAPH_UUID, DEFINITION, projectMetadata); verify(bpmnGraphFactory).build(GRAPH_UUID, DEFINITION, projectMetadata); tested.build(GRAPH_UUID, DEFINITION); verify(caseGraphFactory, never()).build(GRAPH_UUID, DEFINITION, projectMetadata); verify(bpmnGraphFactory).build(GRAPH_UUID, DEFINITION, null); final Metadata metadata = mock(Metadata.class); tested.build(GRAPH_UUID, DEFINITION, metadata); verify(caseGraphFactory, never()).build(GRAPH_UUID, DEFINITION, projectMetadata); verify(bpmnGraphFactory).build(GRAPH_UUID, DEFINITION, metadata); } | @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void build() { tested.build(GRAPH_UUID, DEFINITION); verify(tested).build(GRAPH_UUID, DEFINITION, null); } | @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata) { final Optional<ProjectType> projectType = (Objects.nonNull(metadata) && metadata instanceof ProjectMetadata) ? Optional.ofNullable(((ProjectMetadata) metadata).getProjectType()).map(ProjectType::valueOf) : Optional.empty(); return graphFactoryDelegation.get(projectType).build(uuid, definition, metadata); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void accepts() { assertTrue(tested.accepts(SOURCE)); verify(bpmnGraphFactory).accepts(SOURCE); verify(caseGraphFactory).accepts(SOURCE); } | @Override public boolean accepts(String source) { return bpmnGraphFactory.accepts(source) && caseGraphFactory.accepts(source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean accepts(String source) { return bpmnGraphFactory.accepts(source) && caseGraphFactory.accepts(source); } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean accepts(String source) { return bpmnGraphFactory.accepts(source) && caseGraphFactory.accepts(source); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean accepts(String source) { return bpmnGraphFactory.accepts(source) && caseGraphFactory.accepts(source); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean accepts(String source) { return bpmnGraphFactory.accepts(source) && caseGraphFactory.accepts(source); } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void isDelegateFactory() { assertTrue(tested.isDelegateFactory()); } | @Override public boolean isDelegateFactory() { return true; } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean isDelegateFactory() { return true; } } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean isDelegateFactory() { return true; } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean isDelegateFactory() { return true; } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } | BPMNDelegateGraphFactory implements BPMNGraphFactory { @Override public boolean isDelegateFactory() { return true; } @Inject BPMNDelegateGraphFactory(final BPMNGraphFactoryImpl bpmnGraphFactory,
final CaseGraphFactoryImpl caseGraphFactory); @Override boolean isDelegateFactory(); @Override void setDiagramType(Class<? extends BPMNDiagram> diagramType); @Override Class<? extends ElementFactory> getFactoryType(); @Override Graph<DefinitionSet, Node> build(String uuid, String definition, Metadata metadata); @Override Graph<DefinitionSet, Node> build(String uuid, String definition); @Override boolean accepts(String source); } |
@Test public void testWhiteSpaces() throws Exception { Condition expectedCondition = new Condition("between", Arrays.asList("someVariable", "value1", "value2")); char[] whiteSpaceChars = {'\n', '\t', ' ', '\r'}; String conditionTemplate = "%sreturn%sKieFunctions.between(%ssomeVariable%s,%s\"value1\"%s,%s\"value2\"%s)%s;"; String condition; for (char whiteSpace : whiteSpaceChars) { condition = String.format(conditionTemplate, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace); assertEquals(expectedCondition, new ConditionParser(condition).parse()); } conditionTemplate = "%sreturn%sKieFunctions.between(%ssomeVariable%s.%ssomeMethod%s(%s)%s,%s\"value1\"%s,%s\"value2\"%s)%s;"; for (char whiteSpace : whiteSpaceChars) { condition = String.format(conditionTemplate, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace, whiteSpace); expectedCondition = new Condition("between", Arrays.asList("someVariable.someMethod()", "value1", "value2")); assertEquals(expectedCondition, new ConditionParser(condition).parse()); } } | public Condition parse() throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); functionName = functionName.substring(KIE_FUNCTIONS.length()); List<FunctionDef> functionDefs = FunctionsRegistry.getInstance().getFunctions(functionName); if (functionDefs.isEmpty()) { throw new ParseException(errorMessage(FUNCTION_NAME_NOT_RECOGNIZED_ERROR, functionName), parseIndex); } ParseException lastTryException = null; for (FunctionDef functionDef : functionDefs) { try { reset(); return parse(functionDef); } catch (ParseException e) { lastTryException = e; } } throw lastTryException; } | ConditionParser { public Condition parse() throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); functionName = functionName.substring(KIE_FUNCTIONS.length()); List<FunctionDef> functionDefs = FunctionsRegistry.getInstance().getFunctions(functionName); if (functionDefs.isEmpty()) { throw new ParseException(errorMessage(FUNCTION_NAME_NOT_RECOGNIZED_ERROR, functionName), parseIndex); } ParseException lastTryException = null; for (FunctionDef functionDef : functionDefs) { try { reset(); return parse(functionDef); } catch (ParseException e) { lastTryException = e; } } throw lastTryException; } } | ConditionParser { public Condition parse() throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); functionName = functionName.substring(KIE_FUNCTIONS.length()); List<FunctionDef> functionDefs = FunctionsRegistry.getInstance().getFunctions(functionName); if (functionDefs.isEmpty()) { throw new ParseException(errorMessage(FUNCTION_NAME_NOT_RECOGNIZED_ERROR, functionName), parseIndex); } ParseException lastTryException = null; for (FunctionDef functionDef : functionDefs) { try { reset(); return parse(functionDef); } catch (ParseException e) { lastTryException = e; } } throw lastTryException; } ConditionParser(String expression); } | ConditionParser { public Condition parse() throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); functionName = functionName.substring(KIE_FUNCTIONS.length()); List<FunctionDef> functionDefs = FunctionsRegistry.getInstance().getFunctions(functionName); if (functionDefs.isEmpty()) { throw new ParseException(errorMessage(FUNCTION_NAME_NOT_RECOGNIZED_ERROR, functionName), parseIndex); } ParseException lastTryException = null; for (FunctionDef functionDef : functionDefs) { try { reset(); return parse(functionDef); } catch (ParseException e) { lastTryException = e; } } throw lastTryException; } ConditionParser(String expression); Condition parse(); } | ConditionParser { public Condition parse() throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); functionName = functionName.substring(KIE_FUNCTIONS.length()); List<FunctionDef> functionDefs = FunctionsRegistry.getInstance().getFunctions(functionName); if (functionDefs.isEmpty()) { throw new ParseException(errorMessage(FUNCTION_NAME_NOT_RECOGNIZED_ERROR, functionName), parseIndex); } ParseException lastTryException = null; for (FunctionDef functionDef : functionDefs) { try { reset(); return parse(functionDef); } catch (ParseException e) { lastTryException = e; } } throw lastTryException; } ConditionParser(String expression); Condition parse(); static final String KIE_FUNCTIONS; } |
@Test public void testSetName() { final String name = "name"; this.name.textContent = "something"; view.setName(name); assertEquals(name, this.name.textContent); } | @Override public void setName(final String name) { this.name.textContent = name; } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setName(final String name) { this.name.textContent = name; } } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setName(final String name) { this.name.textContent = name; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setName(final String name) { this.name.textContent = name; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setName(final String name) { this.name.textContent = name; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } |
@Test public void testMissingConditionError() throws Exception { ConditionGenerator generator = new ConditionGenerator(); expectedException.expectMessage("A condition must be provided"); generator.generateScript(null); } | public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } String generateScript(Condition condition); } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } String generateScript(Condition condition); } |
@Test public void testFunctionNotFoundError() throws Exception { ConditionGenerator generator = new ConditionGenerator(); Condition condition = new Condition("SomeNonExistingFunction"); expectedException.expectMessage("Function SomeNonExistingFunction was not found in current functions definitions"); generator.generateScript(condition); } | public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } String generateScript(Condition condition); } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } String generateScript(Condition condition); } |
@Test public void testParamIsNullError() throws Exception { ConditionGenerator generator = new ConditionGenerator(); Condition condition = new Condition("startsWith"); condition.addParam("variable"); condition.addParam(null); expectedException.expectMessage("Parameter can not be null nor empty"); generator.generateScript(condition); } | public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } String generateScript(Condition condition); } | ConditionGenerator { public String generateScript(Condition condition) throws GenerateConditionException { if (condition == null) { throw new GenerateConditionException(MISSING_CONDITION_ERROR); } if (!isValidFunction(condition.getFunction())) { throw new GenerateConditionException(MessageFormat.format(FUNCTION_NOT_FOUND_ERROR, condition.getFunction())); } final String function = condition.getFunction().trim(); final StringBuilder script = new StringBuilder(); script.append("return "); script.append(ConditionParser.KIE_FUNCTIONS); script.append(function); script.append("("); boolean first = true; for (String param : condition.getParams()) { if (param == null || param.isEmpty()) { throw new GenerateConditionException(PARAMETER_NULL_EMPTY); } if (first) { script.append(param); first = false; } else { script.append(", "); script.append("\""); script.append(escapeJavaNonUTFChars(param)); script.append("\""); } } script.append(");"); return script.toString(); } String generateScript(Condition condition); } |
@Test(expected = IndexOutOfBoundsException.class) public void testParseJavaNameWithLowerOutOfBounds() throws ParseException { String someString = "a1234"; char[] someStopCharacters = {}; ParsingUtils.parseJavaName(someString, -1, someStopCharacters); } | public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters); } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters); } |
@Test(expected = IndexOutOfBoundsException.class) public void testParseJavaNameWithHigherOutOfBounds() throws ParseException { String someString = "a1234"; char[] someStopCharacters = {}; ParsingUtils.parseJavaName(someString, someString.length(), someStopCharacters); } | public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters); } | ParsingUtils { public static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters) throws ParseException { if (startIndex < 0 || startIndex >= token.length()) { throw new IndexOutOfBoundsException("startIndex: " + startIndex + " exceeds token bounds: " + token); } final StringBuilder javaName = new StringBuilder(); char currentChar; int currentIndex = startIndex; while (currentIndex < token.length()) { currentChar = token.charAt(currentIndex); if (ArrayUtils.contains(stopCharacters, currentChar)) { break; } else { javaName.append(currentChar); } currentIndex++; } if (javaName.length() == 0) { throw new ParseException("Expected java name was not found at position: " + startIndex, startIndex); } else if (!SourceVersion.isName(javaName)) { throw new ParseException("Invalid java name was found at position: " + startIndex, startIndex); } return javaName.toString(); } static String parseJavaName(final String token, final int startIndex, final char[] stopCharacters); } |
@Test @SuppressWarnings("unchecked") public void testGenerate_masharller() throws Exception { when(backendService.getDiagramMarshaller()).thenReturn(newMarshaller); tested.generate(diagram); verify(newMarshaller, times(1)).marshallToBpmn2Definitions(eq(diagram)); } | @SuppressWarnings("unchecked") public Definitions generate(final Diagram diagram) throws IOException { DiagramMarshaller diagramMarshaller = backendService.getDiagramMarshaller(); return ((BaseDirectDiagramMarshaller) diagramMarshaller).marshallToBpmn2Definitions(diagram); } | FormGenerationModelProviderHelper { @SuppressWarnings("unchecked") public Definitions generate(final Diagram diagram) throws IOException { DiagramMarshaller diagramMarshaller = backendService.getDiagramMarshaller(); return ((BaseDirectDiagramMarshaller) diagramMarshaller).marshallToBpmn2Definitions(diagram); } } | FormGenerationModelProviderHelper { @SuppressWarnings("unchecked") public Definitions generate(final Diagram diagram) throws IOException { DiagramMarshaller diagramMarshaller = backendService.getDiagramMarshaller(); return ((BaseDirectDiagramMarshaller) diagramMarshaller).marshallToBpmn2Definitions(diagram); } FormGenerationModelProviderHelper(final AbstractDefinitionSetService backendService); } | FormGenerationModelProviderHelper { @SuppressWarnings("unchecked") public Definitions generate(final Diagram diagram) throws IOException { DiagramMarshaller diagramMarshaller = backendService.getDiagramMarshaller(); return ((BaseDirectDiagramMarshaller) diagramMarshaller).marshallToBpmn2Definitions(diagram); } FormGenerationModelProviderHelper(final AbstractDefinitionSetService backendService); @SuppressWarnings("unchecked") Definitions generate(final Diagram diagram); } | FormGenerationModelProviderHelper { @SuppressWarnings("unchecked") public Definitions generate(final Diagram diagram) throws IOException { DiagramMarshaller diagramMarshaller = backendService.getDiagramMarshaller(); return ((BaseDirectDiagramMarshaller) diagramMarshaller).marshallToBpmn2Definitions(diagram); } FormGenerationModelProviderHelper(final AbstractDefinitionSetService backendService); @SuppressWarnings("unchecked") Definitions generate(final Diagram diagram); } |
@Test public void testAccepts() { assertTrue(tested.accepts(diagram)); } | @Override public boolean accepts(final Diagram diagram) { return this.definitionSetId.equals(diagram.getMetadata().getDefinitionSetId()); } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public boolean accepts(final Diagram diagram) { return this.definitionSetId.equals(diagram.getMetadata().getDefinitionSetId()); } } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public boolean accepts(final Diagram diagram) { return this.definitionSetId.equals(diagram.getMetadata().getDefinitionSetId()); } protected BPMNFormGenerationModelProvider(); @Inject BPMNFormGenerationModelProvider(final DefinitionUtils definitionUtils,
final BPMNFormGenerationModelProviderHelper formGenerationModelProviderHelper); } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public boolean accepts(final Diagram diagram) { return this.definitionSetId.equals(diagram.getMetadata().getDefinitionSetId()); } protected BPMNFormGenerationModelProvider(); @Inject BPMNFormGenerationModelProvider(final DefinitionUtils definitionUtils,
final BPMNFormGenerationModelProviderHelper formGenerationModelProviderHelper); @PostConstruct void init(); @Override boolean accepts(final Diagram diagram); @Override Definitions generate(final Diagram diagram); } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public boolean accepts(final Diagram diagram) { return this.definitionSetId.equals(diagram.getMetadata().getDefinitionSetId()); } protected BPMNFormGenerationModelProvider(); @Inject BPMNFormGenerationModelProvider(final DefinitionUtils definitionUtils,
final BPMNFormGenerationModelProviderHelper formGenerationModelProviderHelper); @PostConstruct void init(); @Override boolean accepts(final Diagram diagram); @Override Definitions generate(final Diagram diagram); } |
@Test @SuppressWarnings("unchecked") public void testGenerateForBPMNDDirectDiagramMarshaller() throws Exception { when(bpmnDirectDiagramMarshaller.marshallToBpmn2Definitions(diagram)).thenReturn(definitions); when(bpmnBackendService.getDiagramMarshaller()).thenReturn(bpmnDirectDiagramMarshaller); Definitions result = tested.generate(diagram); verify(bpmnDirectDiagramMarshaller, times(1)).marshallToBpmn2Definitions(eq(diagram)); assertEquals(result, definitions); } | @Override public Definitions generate(final Diagram diagram) throws IOException { return formGenerationModelProviderHelper.generate(diagram); } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public Definitions generate(final Diagram diagram) throws IOException { return formGenerationModelProviderHelper.generate(diagram); } } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public Definitions generate(final Diagram diagram) throws IOException { return formGenerationModelProviderHelper.generate(diagram); } protected BPMNFormGenerationModelProvider(); @Inject BPMNFormGenerationModelProvider(final DefinitionUtils definitionUtils,
final BPMNFormGenerationModelProviderHelper formGenerationModelProviderHelper); } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public Definitions generate(final Diagram diagram) throws IOException { return formGenerationModelProviderHelper.generate(diagram); } protected BPMNFormGenerationModelProvider(); @Inject BPMNFormGenerationModelProvider(final DefinitionUtils definitionUtils,
final BPMNFormGenerationModelProviderHelper formGenerationModelProviderHelper); @PostConstruct void init(); @Override boolean accepts(final Diagram diagram); @Override Definitions generate(final Diagram diagram); } | BPMNFormGenerationModelProvider implements FormGenerationModelProvider<Definitions> { @Override public Definitions generate(final Diagram diagram) throws IOException { return formGenerationModelProviderHelper.generate(diagram); } protected BPMNFormGenerationModelProvider(); @Inject BPMNFormGenerationModelProvider(final DefinitionUtils definitionUtils,
final BPMNFormGenerationModelProviderHelper formGenerationModelProviderHelper); @PostConstruct void init(); @Override boolean accepts(final Diagram diagram); @Override Definitions generate(final Diagram diagram); } |
@Test public void testGetRuleFlowGroupNames() { List<RuleFlowGroup> names = tested.getRuleFlowGroupNames(); assertRightRuleFlowGroupNames(names); } | public List<RuleFlowGroup> getRuleFlowGroupNames() { return queryService.getRuleFlowGroupNames(); } | RuleFlowGroupDataService { public List<RuleFlowGroup> getRuleFlowGroupNames() { return queryService.getRuleFlowGroupNames(); } } | RuleFlowGroupDataService { public List<RuleFlowGroup> getRuleFlowGroupNames() { return queryService.getRuleFlowGroupNames(); } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); } | RuleFlowGroupDataService { public List<RuleFlowGroup> getRuleFlowGroupNames() { return queryService.getRuleFlowGroupNames(); } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); List<RuleFlowGroup> getRuleFlowGroupNames(); } | RuleFlowGroupDataService { public List<RuleFlowGroup> getRuleFlowGroupNames() { return queryService.getRuleFlowGroupNames(); } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); List<RuleFlowGroup> getRuleFlowGroupNames(); } |
@Test public void testFireData() { tested.fireData(); ArgumentCaptor<RuleFlowGroupDataEvent> ec = ArgumentCaptor.forClass(RuleFlowGroupDataEvent.class); verify(dataChangedEvent, times(1)).fire(ec.capture()); RuleFlowGroupDataEvent event = ec.getValue(); assertRightRuleFlowGroups(event.getGroups()); } | void fireData() { final RuleFlowGroup[] groupNames = getRuleFlowGroupNames().toArray(new RuleFlowGroup[0]); dataChangedEvent.fire(new RuleFlowGroupDataEvent(groupNames)); } | RuleFlowGroupDataService { void fireData() { final RuleFlowGroup[] groupNames = getRuleFlowGroupNames().toArray(new RuleFlowGroup[0]); dataChangedEvent.fire(new RuleFlowGroupDataEvent(groupNames)); } } | RuleFlowGroupDataService { void fireData() { final RuleFlowGroup[] groupNames = getRuleFlowGroupNames().toArray(new RuleFlowGroup[0]); dataChangedEvent.fire(new RuleFlowGroupDataEvent(groupNames)); } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); } | RuleFlowGroupDataService { void fireData() { final RuleFlowGroup[] groupNames = getRuleFlowGroupNames().toArray(new RuleFlowGroup[0]); dataChangedEvent.fire(new RuleFlowGroupDataEvent(groupNames)); } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); List<RuleFlowGroup> getRuleFlowGroupNames(); } | RuleFlowGroupDataService { void fireData() { final RuleFlowGroup[] groupNames = getRuleFlowGroupNames().toArray(new RuleFlowGroup[0]); dataChangedEvent.fire(new RuleFlowGroupDataEvent(groupNames)); } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); List<RuleFlowGroup> getRuleFlowGroupNames(); } |
@Test public void testSetFile() { final String file = "file"; this.file.textContent = "something"; view.setFile(file); assertEquals(file, this.file.textContent); } | @Override public void setFile(final String file) { this.file.textContent = file; } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setFile(final String file) { this.file.textContent = file; } } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setFile(final String file) { this.file.textContent = file; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setFile(final String file) { this.file.textContent = file; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @Override public void setFile(final String file) { this.file.textContent = file; } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } |
@Test public void testRuleFlowGroupDataService() { RuleFlowGroupDataService tested = spy(new RuleFlowGroupDataService(queryService, dataChangedEvent)); tested.onRequestRuleFlowGroupDataEvent(new RequestRuleFlowGroupDataEvent()); verify(tested).fireData(); } | @Inject public RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService, final Event<RuleFlowGroupDataEvent> dataChangedEvent) { this.queryService = queryService; this.dataChangedEvent = dataChangedEvent; } | RuleFlowGroupDataService { @Inject public RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService, final Event<RuleFlowGroupDataEvent> dataChangedEvent) { this.queryService = queryService; this.dataChangedEvent = dataChangedEvent; } } | RuleFlowGroupDataService { @Inject public RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService, final Event<RuleFlowGroupDataEvent> dataChangedEvent) { this.queryService = queryService; this.dataChangedEvent = dataChangedEvent; } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); } | RuleFlowGroupDataService { @Inject public RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService, final Event<RuleFlowGroupDataEvent> dataChangedEvent) { this.queryService = queryService; this.dataChangedEvent = dataChangedEvent; } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); List<RuleFlowGroup> getRuleFlowGroupNames(); } | RuleFlowGroupDataService { @Inject public RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService, final Event<RuleFlowGroupDataEvent> dataChangedEvent) { this.queryService = queryService; this.dataChangedEvent = dataChangedEvent; } @Inject RuleFlowGroupDataService(final RuleFlowGroupQueryService queryService,
final Event<RuleFlowGroupDataEvent> dataChangedEvent); List<RuleFlowGroup> getRuleFlowGroupNames(); } |
@Test public void getProjectTypeCase() { final ProjectType projectType = tested.getProjectType(projectPath); assertEquals(ProjectType.CASE, projectType); } | @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } @Inject BPMNDiagramProjectService(final @Named("ioStrategy") IOService ioService); BPMNDiagramProjectService(); } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } @Inject BPMNDiagramProjectService(final @Named("ioStrategy") IOService ioService); BPMNDiagramProjectService(); @Override ProjectType getProjectType(Path projectRootPath); } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } @Inject BPMNDiagramProjectService(final @Named("ioStrategy") IOService ioService); BPMNDiagramProjectService(); @Override ProjectType getProjectType(Path projectRootPath); } |
@Test public void getProjectTypeNull() { when(directoryStream.spliterator()).thenReturn(Collections.<Path>emptyList().spliterator()); final ProjectType projectType = tested.getProjectType(projectPath); assertNull(projectType); } | @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } @Inject BPMNDiagramProjectService(final @Named("ioStrategy") IOService ioService); BPMNDiagramProjectService(); } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } @Inject BPMNDiagramProjectService(final @Named("ioStrategy") IOService ioService); BPMNDiagramProjectService(); @Override ProjectType getProjectType(Path projectRootPath); } | BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } @Inject BPMNDiagramProjectService(final @Named("ioStrategy") IOService ioService); BPMNDiagramProjectService(); @Override ProjectType getProjectType(Path projectRootPath); } |
@Test @SuppressWarnings("unchecked") public void testDefaultResultConverter() { RefactoringPageRow row1 = mock(RefactoringPageRow.class); when(row1.getValue()).thenReturn(asMap("row1")); RefactoringPageRow row2 = mock(RefactoringPageRow.class); when(row2.getValue()).thenReturn(asMap("row2")); RefactoringPageRow row3 = mock(RefactoringPageRow.class); when(row3.getValue()).thenReturn(asMap("row3")); RefactoringPageRow row4 = mock(RefactoringPageRow.class); when(row4.getValue()).thenReturn(asMap("row4")); RefactoringPageRow row4_2 = mock(RefactoringPageRow.class); when(row4_2.getValue()).thenReturn(asMap("row4")); RefactoringPageRow emptyRow1 = mock(RefactoringPageRow.class); when(emptyRow1.getValue()).thenReturn(asMap("")); RefactoringPageRow emptyRow2 = mock(RefactoringPageRow.class); when(emptyRow2.getValue()).thenReturn(asMap("")); List<RefactoringPageRow> rows = Arrays.asList(row1, row2, row3, row4, row4_2, emptyRow1, emptyRow2); List<RuleFlowGroup> result = RuleFlowGroupQueryService.DEFAULT_RESULT_CONVERTER.apply(rows); assertEquals(5, result.size()); RuleFlowGroup group1 = new RuleFlowGroup("row1"); RuleFlowGroup group2 = new RuleFlowGroup("row2"); RuleFlowGroup group3 = new RuleFlowGroup("row3"); RuleFlowGroup group4 = new RuleFlowGroup("row4"); assertTrue(result.contains(group1)); assertTrue(result.contains(group2)); assertTrue(result.contains(group3)); assertTrue(result.contains(group4)); } | @SuppressWarnings("unchecked") private static RuleFlowGroup getValue(final RefactoringPageRow row) { Map<String, String> values = (Map<String, String>) row.getValue(); String name = values.get("name"); if (StringUtils.isEmpty(name)) { return null; } RuleFlowGroup group = new RuleFlowGroup(name); group.setFileName(values.get("filename")); group.setPathUri(values.get("pathuri")); return group; } | RuleFlowGroupQueryService { @SuppressWarnings("unchecked") private static RuleFlowGroup getValue(final RefactoringPageRow row) { Map<String, String> values = (Map<String, String>) row.getValue(); String name = values.get("name"); if (StringUtils.isEmpty(name)) { return null; } RuleFlowGroup group = new RuleFlowGroup(name); group.setFileName(values.get("filename")); group.setPathUri(values.get("pathuri")); return group; } } | RuleFlowGroupQueryService { @SuppressWarnings("unchecked") private static RuleFlowGroup getValue(final RefactoringPageRow row) { Map<String, String> values = (Map<String, String>) row.getValue(); String name = values.get("name"); if (StringUtils.isEmpty(name)) { return null; } RuleFlowGroup group = new RuleFlowGroup(name); group.setFileName(values.get("filename")); group.setPathUri(values.get("pathuri")); return group; } RuleFlowGroupQueryService(); @Inject RuleFlowGroupQueryService(final RefactoringQueryService queryService); RuleFlowGroupQueryService(final RefactoringQueryService queryService,
final Function<List<RefactoringPageRow>, List<RuleFlowGroup>> resultToSelectorData); } | RuleFlowGroupQueryService { @SuppressWarnings("unchecked") private static RuleFlowGroup getValue(final RefactoringPageRow row) { Map<String, String> values = (Map<String, String>) row.getValue(); String name = values.get("name"); if (StringUtils.isEmpty(name)) { return null; } RuleFlowGroup group = new RuleFlowGroup(name); group.setFileName(values.get("filename")); group.setPathUri(values.get("pathuri")); return group; } RuleFlowGroupQueryService(); @Inject RuleFlowGroupQueryService(final RefactoringQueryService queryService); RuleFlowGroupQueryService(final RefactoringQueryService queryService,
final Function<List<RefactoringPageRow>, List<RuleFlowGroup>> resultToSelectorData); List<RuleFlowGroup> getRuleFlowGroupNames(); } | RuleFlowGroupQueryService { @SuppressWarnings("unchecked") private static RuleFlowGroup getValue(final RefactoringPageRow row) { Map<String, String> values = (Map<String, String>) row.getValue(); String name = values.get("name"); if (StringUtils.isEmpty(name)) { return null; } RuleFlowGroup group = new RuleFlowGroup(name); group.setFileName(values.get("filename")); group.setPathUri(values.get("pathuri")); return group; } RuleFlowGroupQueryService(); @Inject RuleFlowGroupQueryService(final RefactoringQueryService queryService); RuleFlowGroupQueryService(final RefactoringQueryService queryService,
final Function<List<RefactoringPageRow>, List<RuleFlowGroup>> resultToSelectorData); List<RuleFlowGroup> getRuleFlowGroupNames(); static final Function<List<RefactoringPageRow>, List<RuleFlowGroup>> DEFAULT_RESULT_CONVERTER; } |
@Test public void testGetProcessIdResourceType() throws Exception { assertEquals(tested.getProcessIdResourceType(), ResourceType.BPMN2); } | protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessIdResourceType() { return ResourceType.BPMN2; } } |
@Test public void testGetProcessNameResourceType() throws Exception { assertEquals(tested.getProcessNameResourceType(), ResourceType.BPMN2_NAME); } | protected ResourceType getProcessNameResourceType() { return ResourceType.BPMN2_NAME; } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessNameResourceType() { return ResourceType.BPMN2_NAME; } } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessNameResourceType() { return ResourceType.BPMN2_NAME; } } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessNameResourceType() { return ResourceType.BPMN2_NAME; } } | BpmnProcessDataEventListener extends AbstractBpmnProcessDataEventListener { protected ResourceType getProcessNameResourceType() { return ResourceType.BPMN2_NAME; } } |
@Test public void testGetRegistry() { assertEquals(registry, tested.getRegistry()); } | @Produces @Default public WorkItemDefinitionRegistry getRegistry() { return registry; } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Produces @Default public WorkItemDefinitionRegistry getRegistry() { return registry; } } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Produces @Default public WorkItemDefinitionRegistry getRegistry() { return registry; } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Produces @Default public WorkItemDefinitionRegistry getRegistry() { return registry; } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); @Produces @Default WorkItemDefinitionRegistry getRegistry(); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); @PreDestroy void destroy(); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Produces @Default public WorkItemDefinitionRegistry getRegistry() { return registry; } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); @Produces @Default WorkItemDefinitionRegistry getRegistry(); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); @PreDestroy void destroy(); } |
@Test public void testExecute() { Collection<WorkItemDefinition> result = tested.execute(metadata); assertFalse(result.isEmpty()); assertEquals(2, result.size()); assertTrue(result.contains(wid1)); assertTrue(result.contains(wid2)); } | @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return load(metadata).items(); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return load(metadata).items(); } } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return load(metadata).items(); } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return load(metadata).items(); } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); @Produces @Default WorkItemDefinitionRegistry getRegistry(); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); @PreDestroy void destroy(); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @Override public Collection<WorkItemDefinition> execute(final Metadata metadata) { return load(metadata).items(); } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); @Produces @Default WorkItemDefinitionRegistry getRegistry(); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); @PreDestroy void destroy(); } |
@Test public void testDestroy() { tested.execute(metadata); assertFalse(registry.isEmpty()); tested.destroy(); assertTrue(registry.isEmpty()); } | @PreDestroy public void destroy() { registry.destroy(); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @PreDestroy public void destroy() { registry.destroy(); } } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @PreDestroy public void destroy() { registry.destroy(); } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @PreDestroy public void destroy() { registry.destroy(); } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); @Produces @Default WorkItemDefinitionRegistry getRegistry(); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); @PreDestroy void destroy(); } | WorkItemDefinitionProjectService implements WorkItemDefinitionLookupService { @PreDestroy public void destroy() { registry.destroy(); } @SuppressWarnings("all") protected WorkItemDefinitionProjectService(); @Inject WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices); WorkItemDefinitionProjectService(final WorkItemDefinitionCacheRegistry registry,
final WorkItemDefinitionVFSLookupService vfsService,
final WorkItemDefinitionDeployServices deployServices,
final BiPredicate<Metadata, Collection<WorkItemDefinition>> deployPredicate); @Produces @Default WorkItemDefinitionRegistry getRegistry(); @Override Collection<WorkItemDefinition> execute(final Metadata metadata); @PreDestroy void destroy(); } |
@Test public void testDeploy() { org.uberfire.java.nio.file.Path resourcePath = mock(org.uberfire.java.nio.file.Path.class); when(resources.resolveResourcesPath(eq(metadata))).thenReturn(resourcePath); tested.deploy(metadata, URL); ArgumentCaptor<Assets> assetsArgumentCaptor = ArgumentCaptor.forClass(Assets.class); verify(backendFileSystemManager, times(1)) .deploy(eq(resourcePath), assetsArgumentCaptor.capture(), anyString()); Assets assets = assetsArgumentCaptor.getValue(); assertNotNull(assets); assertEquals(2, assets.getAssets().size()); assertTrue(assets.getAssets().contains(widAsset)); assertTrue(assets.getAssets().contains(iconAsset)); } | @Override public void deploy(final Metadata metadata) { deploy(metadata, System.getProperty(PROPERTY_SERVICE_REPO), System.getProperty(PROPERTY_SERVICE_REPO_TASKNAMES)); } | WorkItemDefinitionRemoteDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { deploy(metadata, System.getProperty(PROPERTY_SERVICE_REPO), System.getProperty(PROPERTY_SERVICE_REPO_TASKNAMES)); } } | WorkItemDefinitionRemoteDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { deploy(metadata, System.getProperty(PROPERTY_SERVICE_REPO), System.getProperty(PROPERTY_SERVICE_REPO_TASKNAMES)); } protected WorkItemDefinitionRemoteDeployService(); @Inject WorkItemDefinitionRemoteDeployService(final WorkItemDefinitionService<WorkItemDefinitionRemoteRequest> remoteLookupService,
final BackendFileSystemManager backendFileSystemManager,
final WorkItemDefinitionResources resources,
final WorkItemDefinitionProjectInstaller projectInstaller); WorkItemDefinitionRemoteDeployService(final WorkItemDefinitionService<WorkItemDefinitionRemoteRequest> remoteLookupService,
final BackendFileSystemManager backendFileSystemManager,
final WorkItemDefinitionResources resources,
final WorkItemDefinitionProjectInstaller projectInstaller,
final Function<WorkItemDefinition, Asset> widAssetBuilder,
final Function<WorkItemDefinition, Asset> iconAssetBuilder); } | WorkItemDefinitionRemoteDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { deploy(metadata, System.getProperty(PROPERTY_SERVICE_REPO), System.getProperty(PROPERTY_SERVICE_REPO_TASKNAMES)); } protected WorkItemDefinitionRemoteDeployService(); @Inject WorkItemDefinitionRemoteDeployService(final WorkItemDefinitionService<WorkItemDefinitionRemoteRequest> remoteLookupService,
final BackendFileSystemManager backendFileSystemManager,
final WorkItemDefinitionResources resources,
final WorkItemDefinitionProjectInstaller projectInstaller); WorkItemDefinitionRemoteDeployService(final WorkItemDefinitionService<WorkItemDefinitionRemoteRequest> remoteLookupService,
final BackendFileSystemManager backendFileSystemManager,
final WorkItemDefinitionResources resources,
final WorkItemDefinitionProjectInstaller projectInstaller,
final Function<WorkItemDefinition, Asset> widAssetBuilder,
final Function<WorkItemDefinition, Asset> iconAssetBuilder); @Override void deploy(final Metadata metadata); } | WorkItemDefinitionRemoteDeployService implements WorkItemDefinitionDeployService { @Override public void deploy(final Metadata metadata) { deploy(metadata, System.getProperty(PROPERTY_SERVICE_REPO), System.getProperty(PROPERTY_SERVICE_REPO_TASKNAMES)); } protected WorkItemDefinitionRemoteDeployService(); @Inject WorkItemDefinitionRemoteDeployService(final WorkItemDefinitionService<WorkItemDefinitionRemoteRequest> remoteLookupService,
final BackendFileSystemManager backendFileSystemManager,
final WorkItemDefinitionResources resources,
final WorkItemDefinitionProjectInstaller projectInstaller); WorkItemDefinitionRemoteDeployService(final WorkItemDefinitionService<WorkItemDefinitionRemoteRequest> remoteLookupService,
final BackendFileSystemManager backendFileSystemManager,
final WorkItemDefinitionResources resources,
final WorkItemDefinitionProjectInstaller projectInstaller,
final Function<WorkItemDefinition, Asset> widAssetBuilder,
final Function<WorkItemDefinition, Asset> iconAssetBuilder); @Override void deploy(final Metadata metadata); static final String PROPERTY_SERVICE_REPO; static final String PROPERTY_SERVICE_REPO_TASKNAMES; } |
@Test public void testDecisionComponentItemMouseDown() { final MouseDownEvent mouseDownEvent = mock(MouseDownEvent.class); final Callback proxy = mock(Callback.class); final DRGElement drgElement = mock(DRGElement.class); final DMNShapeFactory factory = mock(DMNShapeFactory.class); final ShapeGlyphDragHandler.Item item = mock(ShapeGlyphDragHandler.Item.class); final Glyph glyph = mock(Glyph.class); final int x = 10; final int y = 20; when(dmnShapeSet.getShapeFactory()).thenReturn(factory); when(presenter.getDrgElement()).thenReturn(drgElement); when(factory.getGlyph(any())).thenReturn(glyph); when(mouseDownEvent.getX()).thenReturn(x); when(mouseDownEvent.getY()).thenReturn(y); doReturn(proxy).when(view).makeDragProxyCallbackImpl(drgElement, factory); doReturn(item).when(view).makeDragHandler(glyph); view.decisionComponentItemMouseDown(mouseDownEvent); verify(shapeGlyphDragHandler).show(item, x, y, proxy); } | @EventHandler("decision-component-item") public void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent) { final DRGElement drgElement = presenter.getDrgElement(); final ShapeFactory factory = dmnShapeSet.getShapeFactory(); final Glyph glyph = factory.getGlyph(drgElement.getClass().getName()); final ShapeGlyphDragHandler.Item item = makeDragHandler(glyph); final Callback proxy = makeDragProxyCallbackImpl(drgElement, factory); shapeGlyphDragHandler.show(item, mouseDownEvent.getX(), mouseDownEvent.getY(), proxy); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @EventHandler("decision-component-item") public void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent) { final DRGElement drgElement = presenter.getDrgElement(); final ShapeFactory factory = dmnShapeSet.getShapeFactory(); final Glyph glyph = factory.getGlyph(drgElement.getClass().getName()); final ShapeGlyphDragHandler.Item item = makeDragHandler(glyph); final Callback proxy = makeDragProxyCallbackImpl(drgElement, factory); shapeGlyphDragHandler.show(item, mouseDownEvent.getX(), mouseDownEvent.getY(), proxy); } } | DecisionComponentsItemView implements DecisionComponentsItem.View { @EventHandler("decision-component-item") public void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent) { final DRGElement drgElement = presenter.getDrgElement(); final ShapeFactory factory = dmnShapeSet.getShapeFactory(); final Glyph glyph = factory.getGlyph(drgElement.getClass().getName()); final ShapeGlyphDragHandler.Item item = makeDragHandler(glyph); final Callback proxy = makeDragProxyCallbackImpl(drgElement, factory); shapeGlyphDragHandler.show(item, mouseDownEvent.getX(), mouseDownEvent.getY(), proxy); } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @EventHandler("decision-component-item") public void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent) { final DRGElement drgElement = presenter.getDrgElement(); final ShapeFactory factory = dmnShapeSet.getShapeFactory(); final Glyph glyph = factory.getGlyph(drgElement.getClass().getName()); final ShapeGlyphDragHandler.Item item = makeDragHandler(glyph); final Callback proxy = makeDragProxyCallbackImpl(drgElement, factory); shapeGlyphDragHandler.show(item, mouseDownEvent.getX(), mouseDownEvent.getY(), proxy); } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } | DecisionComponentsItemView implements DecisionComponentsItem.View { @EventHandler("decision-component-item") public void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent) { final DRGElement drgElement = presenter.getDrgElement(); final ShapeFactory factory = dmnShapeSet.getShapeFactory(); final Glyph glyph = factory.getGlyph(drgElement.getClass().getName()); final ShapeGlyphDragHandler.Item item = makeDragHandler(glyph); final Callback proxy = makeDragProxyCallbackImpl(drgElement, factory); shapeGlyphDragHandler.show(item, mouseDownEvent.getX(), mouseDownEvent.getY(), proxy); } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } |
@Test public void testInstall() { KieModule module = mock(KieModule.class); Path pomXMLPath = mock(Path.class); POM pom = mock(POM.class); when(moduleService.resolveModule(eq(root))).thenReturn(module); when(module.getPomXMLPath()).thenReturn(pomXMLPath); when(pomService.load(eq(pomXMLPath))).thenReturn(pom); Dependencies dependencies = new Dependencies(Collections.emptyList()); when(pom.getDependencies()).thenReturn(dependencies); org.guvnor.common.services.shared.metadata.model.Metadata projMetadata = mock(org.guvnor.common.services.shared.metadata.model.Metadata.class); when(metadataService.getMetadata(pomXMLPath)).thenReturn(projMetadata); tested.install(Collections.singleton(WID), this.metadata); verify(pomService, times(1)) .save(eq(pomXMLPath), eq(pom), eq(projMetadata), anyString(), eq(false)); } | @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } | WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } } | WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } protected WorkItemDefinitionProjectInstaller(); @Inject WorkItemDefinitionProjectInstaller(final POMService pomService,
final MetadataService metadataService,
final KieModuleService moduleService); } | WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } protected WorkItemDefinitionProjectInstaller(); @Inject WorkItemDefinitionProjectInstaller(final POMService pomService,
final MetadataService metadataService,
final KieModuleService moduleService); @SuppressWarnings("all") void install(final Collection<WorkItemDefinition> items,
final Metadata metadata); } | WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } protected WorkItemDefinitionProjectInstaller(); @Inject WorkItemDefinitionProjectInstaller(final POMService pomService,
final MetadataService metadataService,
final KieModuleService moduleService); @SuppressWarnings("all") void install(final Collection<WorkItemDefinition> items,
final Metadata metadata); } |
@Test public void convert() { final Result<BpmnNode> node = tested.convert(element); final Node<? extends View<? extends BPMNViewDefinition>, ?> value = node.value().value(); assertEquals(content, value.getContent()); assertEquals(def, value.getContent().getDefinition()); } | @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.DataObjectReference element) { return convert(element, propertyReaderFactory.of(element)); } | DataObjectConverter implements NodeConverter<org.eclipse.bpmn2.DataObjectReference> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.DataObjectReference element) { return convert(element, propertyReaderFactory.of(element)); } } | DataObjectConverter implements NodeConverter<org.eclipse.bpmn2.DataObjectReference> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.DataObjectReference element) { return convert(element, propertyReaderFactory.of(element)); } DataObjectConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); } | DataObjectConverter implements NodeConverter<org.eclipse.bpmn2.DataObjectReference> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.DataObjectReference element) { return convert(element, propertyReaderFactory.of(element)); } DataObjectConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.DataObjectReference element); } | DataObjectConverter implements NodeConverter<org.eclipse.bpmn2.DataObjectReference> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.DataObjectReference element) { return convert(element, propertyReaderFactory.of(element)); } DataObjectConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.DataObjectReference element); } |
@Test public void convert() { final Result<BpmnNode> node = tested.convert(element); final Node<? extends View<? extends BPMNViewDefinition>, ?> value = node.value().value(); assertEquals(content, value.getContent()); assertEquals(def, value.getContent().getDefinition()); } | @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.TextAnnotation element) { return convert(element, propertyReaderFactory.of(element)); } | TextAnnotationConverter implements NodeConverter<org.eclipse.bpmn2.TextAnnotation> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.TextAnnotation element) { return convert(element, propertyReaderFactory.of(element)); } } | TextAnnotationConverter implements NodeConverter<org.eclipse.bpmn2.TextAnnotation> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.TextAnnotation element) { return convert(element, propertyReaderFactory.of(element)); } TextAnnotationConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); } | TextAnnotationConverter implements NodeConverter<org.eclipse.bpmn2.TextAnnotation> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.TextAnnotation element) { return convert(element, propertyReaderFactory.of(element)); } TextAnnotationConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.TextAnnotation element); } | TextAnnotationConverter implements NodeConverter<org.eclipse.bpmn2.TextAnnotation> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.TextAnnotation element) { return convert(element, propertyReaderFactory.of(element)); } TextAnnotationConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.TextAnnotation element); } |
@Test public void testMakeDragHandler() { final Glyph glyph = mock(Glyph.class); final Item item = view.makeDragHandler(glyph); assertEquals(16, item.getHeight()); assertEquals(16, item.getWidth()); assertEquals(glyph, item.getShape()); } | ShapeGlyphDragHandler.Item makeDragHandler(final Glyph glyph) { return new DragHandler(glyph); } | DecisionComponentsItemView implements DecisionComponentsItem.View { ShapeGlyphDragHandler.Item makeDragHandler(final Glyph glyph) { return new DragHandler(glyph); } } | DecisionComponentsItemView implements DecisionComponentsItem.View { ShapeGlyphDragHandler.Item makeDragHandler(final Glyph glyph) { return new DragHandler(glyph); } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); } | DecisionComponentsItemView implements DecisionComponentsItem.View { ShapeGlyphDragHandler.Item makeDragHandler(final Glyph glyph) { return new DragHandler(glyph); } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } | DecisionComponentsItemView implements DecisionComponentsItem.View { ShapeGlyphDragHandler.Item makeDragHandler(final Glyph glyph) { return new DragHandler(glyph); } @Inject DecisionComponentsItemView(final HTMLImageElement icon,
final @Named("h5") HTMLHeadingElement name,
final HTMLParagraphElement file,
final DMNShapeSet dmnShapeSet,
final SessionManager sessionManager,
final ShapeGlyphDragHandler shapeGlyphDragHandler,
final Event<BuildCanvasShapeEvent> buildCanvasShapeEvent,
final HTMLDivElement decisionComponentItem,
final Event<NotificationEvent> notificationEvent,
final ClientTranslationService clientTranslationService); @Override void init(final DecisionComponentsItem presenter); @Override void setIcon(final String iconURI); @Override void setName(final String name); @Override void setFile(final String file); @Override void setIsImported(final boolean imported); @EventHandler("decision-component-item") void decisionComponentItemMouseDown(final MouseDownEvent mouseDownEvent); } |
@Test public void testNullBody() { final Assignment assignment = createAssignment(null); final InputAssignmentReader iar = new InputAssignmentReader(assignment, ID); final AssociationDeclaration associationDeclaration = iar.getAssociationDeclaration(); assertEquals(AssociationDeclaration.Type.FromTo, associationDeclaration.getType()); assertEquals("", associationDeclaration.getSource()); } | public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in); AssociationDeclaration getAssociationDeclaration(); } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in); AssociationDeclaration getAssociationDeclaration(); } |
@Test public void testNullAssociations() { when(association.getSourceRef()).thenReturn(new ArrayDelegatingEList<ItemAwareElement>() { @Override public Object[] data() { return null; } }); when(association.getAssignment()).thenReturn(new ArrayDelegatingEList<Assignment>() { @Override public Object[] data() { return null; } }); when(association.getTargetRef()).thenReturn(element); when(element.getName()).thenReturn("someName"); final Optional<InputAssignmentReader> reader = InputAssignmentReader.fromAssociation(association); assertEquals(false, reader.isPresent()); } | public static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in) { List<ItemAwareElement> sourceList = in.getSourceRef(); List<Assignment> assignmentList = in.getAssignment(); String targetName = ((DataInput) in.getTargetRef()).getName(); if (isReservedIdentifier(targetName)) { return Optional.empty(); } if (!sourceList.isEmpty()) { return Optional.of(new InputAssignmentReader(sourceList.get(0), targetName)); } else if (!assignmentList.isEmpty()) { return Optional.of(new InputAssignmentReader(assignmentList.get(0), targetName)); } else { logger.log(Level.SEVERE, MarshallingMessage.builder().message("Cannot find SourceRef or Assignment for Target ").toString() + targetName); return Optional.empty(); } } | InputAssignmentReader { public static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in) { List<ItemAwareElement> sourceList = in.getSourceRef(); List<Assignment> assignmentList = in.getAssignment(); String targetName = ((DataInput) in.getTargetRef()).getName(); if (isReservedIdentifier(targetName)) { return Optional.empty(); } if (!sourceList.isEmpty()) { return Optional.of(new InputAssignmentReader(sourceList.get(0), targetName)); } else if (!assignmentList.isEmpty()) { return Optional.of(new InputAssignmentReader(assignmentList.get(0), targetName)); } else { logger.log(Level.SEVERE, MarshallingMessage.builder().message("Cannot find SourceRef or Assignment for Target ").toString() + targetName); return Optional.empty(); } } } | InputAssignmentReader { public static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in) { List<ItemAwareElement> sourceList = in.getSourceRef(); List<Assignment> assignmentList = in.getAssignment(); String targetName = ((DataInput) in.getTargetRef()).getName(); if (isReservedIdentifier(targetName)) { return Optional.empty(); } if (!sourceList.isEmpty()) { return Optional.of(new InputAssignmentReader(sourceList.get(0), targetName)); } else if (!assignmentList.isEmpty()) { return Optional.of(new InputAssignmentReader(assignmentList.get(0), targetName)); } else { logger.log(Level.SEVERE, MarshallingMessage.builder().message("Cannot find SourceRef or Assignment for Target ").toString() + targetName); return Optional.empty(); } } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); } | InputAssignmentReader { public static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in) { List<ItemAwareElement> sourceList = in.getSourceRef(); List<Assignment> assignmentList = in.getAssignment(); String targetName = ((DataInput) in.getTargetRef()).getName(); if (isReservedIdentifier(targetName)) { return Optional.empty(); } if (!sourceList.isEmpty()) { return Optional.of(new InputAssignmentReader(sourceList.get(0), targetName)); } else if (!assignmentList.isEmpty()) { return Optional.of(new InputAssignmentReader(assignmentList.get(0), targetName)); } else { logger.log(Level.SEVERE, MarshallingMessage.builder().message("Cannot find SourceRef or Assignment for Target ").toString() + targetName); return Optional.empty(); } } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in); AssociationDeclaration getAssociationDeclaration(); } | InputAssignmentReader { public static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in) { List<ItemAwareElement> sourceList = in.getSourceRef(); List<Assignment> assignmentList = in.getAssignment(); String targetName = ((DataInput) in.getTargetRef()).getName(); if (isReservedIdentifier(targetName)) { return Optional.empty(); } if (!sourceList.isEmpty()) { return Optional.of(new InputAssignmentReader(sourceList.get(0), targetName)); } else if (!assignmentList.isEmpty()) { return Optional.of(new InputAssignmentReader(assignmentList.get(0), targetName)); } else { logger.log(Level.SEVERE, MarshallingMessage.builder().message("Cannot find SourceRef or Assignment for Target ").toString() + targetName); return Optional.empty(); } } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in); AssociationDeclaration getAssociationDeclaration(); } |
@Test public void testNullTimeParameters() { assertEquals(new SimulationAttributeSet(), SimulationAttributeSets.of(simulationParameters)); } | public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } |
@Test public void testTimeParamsWithNullValue() { TimeParameters timeParameters = factory.createTimeParameters(); simulationParameters.setTimeParameters(timeParameters); assertEquals(new SimulationAttributeSet(), SimulationAttributeSets.of(simulationParameters)); } | public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } |
@Test public void testTimeParamsWithEmptyParameter() { TimeParameters timeParameters = factory.createTimeParameters(); Parameter parameter = factory.createParameter(); timeParameters.setProcessingTime(parameter); simulationParameters.setTimeParameters(timeParameters); assertEquals(new SimulationAttributeSet(), SimulationAttributeSets.of(simulationParameters)); } | public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } |
@Test public void testGetNameFromExtensionElement() { EList<ExtensionAttributeValue> extensionValues = mockExtensionValues(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, METADATA_ELEMENT_NAME, NAME); when(lane.getName()).thenReturn(null); when(lane.getExtensionValues()).thenReturn(extensionValues); LanePropertyReader propertyReader = new LanePropertyReader(lane, diagram, shape, RESOLUTION_FACTOR); assertEquals(NAME, propertyReader.getName()); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } |
@Test public void testDestroyState() { assertNotNull(dmnDiagramsSession.getSessionState()); dmnDiagramsSession.destroyState(metadata); assertNull(dmnDiagramsSession.getSessionState()); } | public void destroyState(final Metadata metadata) { dmnSessionStatesByPathURI.remove(getSessionKey(metadata)); } | DMNDiagramsSession implements GraphsProvider { public void destroyState(final Metadata metadata) { dmnSessionStatesByPathURI.remove(getSessionKey(metadata)); } } | DMNDiagramsSession implements GraphsProvider { public void destroyState(final Metadata metadata) { dmnSessionStatesByPathURI.remove(getSessionKey(metadata)); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramsSession implements GraphsProvider { public void destroyState(final Metadata metadata) { dmnSessionStatesByPathURI.remove(getSessionKey(metadata)); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } | DMNDiagramsSession implements GraphsProvider { public void destroyState(final Metadata metadata) { dmnSessionStatesByPathURI.remove(getSessionKey(metadata)); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } |
@Test public void getExtendedName() { String name = tested.getName(); assertEquals("custom", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void getName() { when(element.getExtensionValues()).thenReturn(ECollections.emptyEList()); String name = tested.getName(); assertEquals("name", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void getTextName() { when(element.getExtensionValues()).thenReturn(ECollections.emptyEList()); when(element.getName()).thenReturn(null); String name = tested.getName(); assertEquals("text", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void getNameNull() { when(element.getExtensionValues()).thenReturn(ECollections.emptyEList()); when(element.getName()).thenReturn(null); when(element.getText()).thenReturn(null); String name = tested.getName(); assertEquals("", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return ConverterUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void testGetCurrentSessionKey() { assertEquals(uri, dmnDiagramsSession.getCurrentSessionKey()); } | public String getCurrentSessionKey() { return Optional .ofNullable(getCurrentGraphDiagram()) .map(diagram -> getSessionKey(diagram.getMetadata())) .orElse(""); } | DMNDiagramsSession implements GraphsProvider { public String getCurrentSessionKey() { return Optional .ofNullable(getCurrentGraphDiagram()) .map(diagram -> getSessionKey(diagram.getMetadata())) .orElse(""); } } | DMNDiagramsSession implements GraphsProvider { public String getCurrentSessionKey() { return Optional .ofNullable(getCurrentGraphDiagram()) .map(diagram -> getSessionKey(diagram.getMetadata())) .orElse(""); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramsSession implements GraphsProvider { public String getCurrentSessionKey() { return Optional .ofNullable(getCurrentGraphDiagram()) .map(diagram -> getSessionKey(diagram.getMetadata())) .orElse(""); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } | DMNDiagramsSession implements GraphsProvider { public String getCurrentSessionKey() { return Optional .ofNullable(getCurrentGraphDiagram()) .map(diagram -> getSessionKey(diagram.getMetadata())) .orElse(""); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } |
@Test public void testGetCollectionInput() { ItemAwareElement item = mockItemAwareElement(ITEM_ID); when(miloop.getLoopDataInputRef()).thenReturn(item); EList<DataInputAssociation> inputAssociations = ECollections.singletonEList(mockDataInputAssociation(ITEM_ID, PROPERTY_ID)); when(activity.getDataInputAssociations()).thenReturn(inputAssociations); assertEquals(PROPERTY_ID, reader.getCollectionInput()); } | public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void testGetCollectionOutput() { ItemAwareElement item = mockItemAwareElement(ITEM_ID); when(miloop.getLoopDataOutputRef()).thenReturn(item); EList<DataOutputAssociation> outputAssociations = ECollections.singletonEList(mockDataOutputAssociation(ITEM_ID, PROPERTY_ID)); when(activity.getDataOutputAssociations()).thenReturn(outputAssociations); assertEquals(PROPERTY_ID, reader.getCollectionOutput()); } | public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void getGenericServiceTask() { GenericServiceTaskValue task = reader.getGenericServiceTask(); assertEquals("Java", task.getServiceImplementation()); assertEquals("serviceOperation", task.getServiceOperation()); assertEquals("serviceInterface", task.getServiceInterface()); assertEquals(SLA_DUE_DATE_CDATA, reader.getSLADueDate()); assertEquals(false, reader.isAsync()); assertEquals(true, reader.isAdHocAutostart()); assertNotNull(reader.getOnEntryAction()); assertNotNull(reader.getOnExitAction()); assertNotNull(reader.getAssignmentsInfo()); } | public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } GenericServiceTaskPropertyReader(ServiceTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } GenericServiceTaskPropertyReader(ServiceTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); GenericServiceTaskValue getGenericServiceTask(); static String getServiceImplementation(String implementation); boolean isAsync(); boolean isAdHocAutostart(); String getSLADueDate(); } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } GenericServiceTaskPropertyReader(ServiceTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); GenericServiceTaskValue getGenericServiceTask(); static String getServiceImplementation(String implementation); boolean isAsync(); boolean isAdHocAutostart(); String getSLADueDate(); static final String JAVA; static final String WEB_SERVICE; } |
@Test public void testGetDMNDiagrams() { final List<DMNDiagramTuple> expected = asList(mock(DMNDiagramTuple.class), mock(DMNDiagramTuple.class)); doReturn(expected).when(dmnDiagramsSessionState).getDMNDiagrams(); final List<DMNDiagramTuple> actual = dmnDiagramsSession.getDMNDiagrams(); assertEquals(expected, actual); } | public List<DMNDiagramTuple> getDMNDiagrams() { return getSessionState().getDMNDiagrams(); } | DMNDiagramsSession implements GraphsProvider { public List<DMNDiagramTuple> getDMNDiagrams() { return getSessionState().getDMNDiagrams(); } } | DMNDiagramsSession implements GraphsProvider { public List<DMNDiagramTuple> getDMNDiagrams() { return getSessionState().getDMNDiagrams(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramsSession implements GraphsProvider { public List<DMNDiagramTuple> getDMNDiagrams() { return getSessionState().getDMNDiagrams(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } | DMNDiagramsSession implements GraphsProvider { public List<DMNDiagramTuple> getDMNDiagrams() { return getSessionState().getDMNDiagrams(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } |
@Test public void testGetSourceId() { assertEquals(SOURCE_ID, propertyReader.getSourceId()); } | @Override public String getSourceId() { return association.getSourceRef().getId(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getSourceId() { return association.getSourceRef().getId(); } } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getSourceId() { return association.getSourceRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getSourceId() { return association.getSourceRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getSourceId() { return association.getSourceRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } |
@Test public void testGetTargetId() { assertEquals(TARGET_ID, propertyReader.getTargetId()); } | @Override public String getTargetId() { return association.getTargetRef().getId(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getTargetId() { return association.getTargetRef().getId(); } } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getTargetId() { return association.getTargetRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getTargetId() { return association.getTargetRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getTargetId() { return association.getTargetRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } |
@Test public void testGetSourceConnection() { mockStatic(PropertyReaderUtils.class); PowerMockito.when(PropertyReaderUtils.getSourcePosition(definitionResolver, ASSOCIATION_ID, SOURCE_ID)).thenReturn(position); boolean arbitraryBoolean = true; PowerMockito.when(PropertyReaderUtils.isAutoConnectionSource(association)).thenReturn(arbitraryBoolean); Connection result = propertyReader.getSourceConnection(); assertEquals(X, result.getLocation().getX(), 0); assertEquals(Y, result.getLocation().getY(), 0); } | @Override public Connection getSourceConnection() { Point2D sourcePosition = PropertyReaderUtils.getSourcePosition(definitionResolver, element.getId(), getSourceId()); return MagnetConnection.Builder .at(sourcePosition.getX(), sourcePosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionSource(element)); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getSourceConnection() { Point2D sourcePosition = PropertyReaderUtils.getSourcePosition(definitionResolver, element.getId(), getSourceId()); return MagnetConnection.Builder .at(sourcePosition.getX(), sourcePosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionSource(element)); } } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getSourceConnection() { Point2D sourcePosition = PropertyReaderUtils.getSourcePosition(definitionResolver, element.getId(), getSourceId()); return MagnetConnection.Builder .at(sourcePosition.getX(), sourcePosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionSource(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getSourceConnection() { Point2D sourcePosition = PropertyReaderUtils.getSourcePosition(definitionResolver, element.getId(), getSourceId()); return MagnetConnection.Builder .at(sourcePosition.getX(), sourcePosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionSource(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getSourceConnection() { Point2D sourcePosition = PropertyReaderUtils.getSourcePosition(definitionResolver, element.getId(), getSourceId()); return MagnetConnection.Builder .at(sourcePosition.getX(), sourcePosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionSource(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } |
@Test public void testGetTargetConnection() { mockStatic(PropertyReaderUtils.class); PowerMockito.when(PropertyReaderUtils.getTargetPosition(definitionResolver, ASSOCIATION_ID, TARGET_ID)).thenReturn(position); boolean arbitraryBoolean = true; PowerMockito.when(PropertyReaderUtils.isAutoConnectionSource(association)).thenReturn(arbitraryBoolean); Connection result = propertyReader.getTargetConnection(); assertEquals(X, result.getLocation().getX(), 0); assertEquals(Y, result.getLocation().getY(), 0); } | @Override public Connection getTargetConnection() { Point2D targetPosition = PropertyReaderUtils.getTargetPosition(definitionResolver, element.getId(), getTargetId()); return MagnetConnection.Builder .at(targetPosition.getX(), targetPosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionTarget(element)); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getTargetConnection() { Point2D targetPosition = PropertyReaderUtils.getTargetPosition(definitionResolver, element.getId(), getTargetId()); return MagnetConnection.Builder .at(targetPosition.getX(), targetPosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionTarget(element)); } } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getTargetConnection() { Point2D targetPosition = PropertyReaderUtils.getTargetPosition(definitionResolver, element.getId(), getTargetId()); return MagnetConnection.Builder .at(targetPosition.getX(), targetPosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionTarget(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getTargetConnection() { Point2D targetPosition = PropertyReaderUtils.getTargetPosition(definitionResolver, element.getId(), getTargetId()); return MagnetConnection.Builder .at(targetPosition.getX(), targetPosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionTarget(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getTargetConnection() { Point2D targetPosition = PropertyReaderUtils.getTargetPosition(definitionResolver, element.getId(), getTargetId()); return MagnetConnection.Builder .at(targetPosition.getX(), targetPosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionTarget(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } |
@Test public void testGetAssociationByDirection() { final Association association = Bpmn2Factory.eINSTANCE.createAssociation(); association.setAssociationDirection(null); propertyReader = new AssociationPropertyReader(association, bpmnDiagram, definitionResolver); assertEquals(NonDirectionalAssociation.class, propertyReader.getAssociationByDirection()); association.setAssociationDirection(AssociationDirection.NONE); assertEquals(NonDirectionalAssociation.class, propertyReader.getAssociationByDirection()); association.setAssociationDirection(AssociationDirection.ONE); assertEquals(DirectionalAssociation.class, propertyReader.getAssociationByDirection()); } | public Class getAssociationByDirection() { AssociationDirection d = association.getAssociationDirection(); if (!AssociationDirection.NONE.equals(d)) { return DirectionalAssociation.class; } return NonDirectionalAssociation.class; } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { public Class getAssociationByDirection() { AssociationDirection d = association.getAssociationDirection(); if (!AssociationDirection.NONE.equals(d)) { return DirectionalAssociation.class; } return NonDirectionalAssociation.class; } } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { public Class getAssociationByDirection() { AssociationDirection d = association.getAssociationDirection(); if (!AssociationDirection.NONE.equals(d)) { return DirectionalAssociation.class; } return NonDirectionalAssociation.class; } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { public Class getAssociationByDirection() { AssociationDirection d = association.getAssociationDirection(); if (!AssociationDirection.NONE.equals(d)) { return DirectionalAssociation.class; } return NonDirectionalAssociation.class; } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { public Class getAssociationByDirection() { AssociationDirection d = association.getAssociationDirection(); if (!AssociationDirection.NONE.equals(d)) { return DirectionalAssociation.class; } return NonDirectionalAssociation.class; } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } |
@Test @SuppressWarnings("unchecked") public void testGetControlPoints() { List<Point2D> controlPoints = mock(List.class); mockStatic(PropertyReaderUtils.class); PowerMockito.when(PropertyReaderUtils.getControlPoints(definitionResolver, ASSOCIATION_ID)).thenReturn(controlPoints); assertEquals(controlPoints, propertyReader.getControlPoints()); } | @Override public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } | AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); } |
@Test public void testGetCurrentDMNDiagramElement() { final DMNDiagramElement diagramElement = new DMNDiagramElement(); final Diagram stunnerDiagram = mock(Diagram.class); final DMNDiagramSelected selectedDiagram = new DMNDiagramSelected(diagramElement); dmnDiagramsSession.add(diagramElement, stunnerDiagram); dmnDiagramsSession.onDMNDiagramSelected(selectedDiagram); final Optional<DMNDiagramElement> currentDMNDiagramElement = dmnDiagramsSession.getCurrentDMNDiagramElement(); assertTrue(currentDMNDiagramElement.isPresent()); assertEquals(diagramElement, currentDMNDiagramElement.get()); } | public Optional<DMNDiagramElement> getCurrentDMNDiagramElement() { return getSessionState().getCurrentDMNDiagramElement(); } | DMNDiagramsSession implements GraphsProvider { public Optional<DMNDiagramElement> getCurrentDMNDiagramElement() { return getSessionState().getCurrentDMNDiagramElement(); } } | DMNDiagramsSession implements GraphsProvider { public Optional<DMNDiagramElement> getCurrentDMNDiagramElement() { return getSessionState().getCurrentDMNDiagramElement(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramsSession implements GraphsProvider { public Optional<DMNDiagramElement> getCurrentDMNDiagramElement() { return getSessionState().getCurrentDMNDiagramElement(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } | DMNDiagramsSession implements GraphsProvider { public Optional<DMNDiagramElement> getCurrentDMNDiagramElement() { return getSessionState().getCurrentDMNDiagramElement(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } |
@Test public void JBPM_7447_shouldNotFilterOutDataOutputsWithEmptyType() { DataInput dataInput = bpmn2.createDataInput(); dataInput.setName("InputName"); dataInput.setId("InputID"); DataOutput dataOutput = bpmn2.createDataOutput(); dataOutput.setName("OutputName"); dataOutput.setId("OutputID"); ParsedAssignmentsInfo result = AssignmentsInfos.parsed( Collections.singletonList(dataInput), Collections.emptyList(), Collections.singletonList(dataOutput), Collections.emptyList(), false ); assertFalse(result.getOutputs().getDeclarations().isEmpty()); } | public static ParsedAssignmentsInfo parsed( List<DataInput> datainput, List<DataInputAssociation> inputAssociations, List<DataOutput> dataoutput, List<DataOutputAssociation> outputAssociations, boolean alternativeEncoding) { DeclarationList inputs = dataInputDeclarations(datainput); DeclarationList outputs = dataOutputDeclarations(dataoutput); AssociationList associations = new AssociationList( inAssociationDeclarations(inputAssociations), outAssociationDeclarations(outputAssociations)); return new ParsedAssignmentsInfo( inputs, outputs, associations, alternativeEncoding); } | AssignmentsInfos { public static ParsedAssignmentsInfo parsed( List<DataInput> datainput, List<DataInputAssociation> inputAssociations, List<DataOutput> dataoutput, List<DataOutputAssociation> outputAssociations, boolean alternativeEncoding) { DeclarationList inputs = dataInputDeclarations(datainput); DeclarationList outputs = dataOutputDeclarations(dataoutput); AssociationList associations = new AssociationList( inAssociationDeclarations(inputAssociations), outAssociationDeclarations(outputAssociations)); return new ParsedAssignmentsInfo( inputs, outputs, associations, alternativeEncoding); } } | AssignmentsInfos { public static ParsedAssignmentsInfo parsed( List<DataInput> datainput, List<DataInputAssociation> inputAssociations, List<DataOutput> dataoutput, List<DataOutputAssociation> outputAssociations, boolean alternativeEncoding) { DeclarationList inputs = dataInputDeclarations(datainput); DeclarationList outputs = dataOutputDeclarations(dataoutput); AssociationList associations = new AssociationList( inAssociationDeclarations(inputAssociations), outAssociationDeclarations(outputAssociations)); return new ParsedAssignmentsInfo( inputs, outputs, associations, alternativeEncoding); } } | AssignmentsInfos { public static ParsedAssignmentsInfo parsed( List<DataInput> datainput, List<DataInputAssociation> inputAssociations, List<DataOutput> dataoutput, List<DataOutputAssociation> outputAssociations, boolean alternativeEncoding) { DeclarationList inputs = dataInputDeclarations(datainput); DeclarationList outputs = dataOutputDeclarations(dataoutput); AssociationList associations = new AssociationList( inAssociationDeclarations(inputAssociations), outAssociationDeclarations(outputAssociations)); return new ParsedAssignmentsInfo( inputs, outputs, associations, alternativeEncoding); } static AssignmentsInfo of(
final List<DataInput> datainput,
final List<DataInputAssociation> inputAssociations,
final List<DataOutput> dataoutput,
final List<DataOutputAssociation> outputAssociations,
boolean alternativeEncoding); static ParsedAssignmentsInfo parsed(
List<DataInput> datainput,
List<DataInputAssociation> inputAssociations,
List<DataOutput> dataoutput,
List<DataOutputAssociation> outputAssociations,
boolean alternativeEncoding); static boolean isReservedDeclaration(DataInput o); static boolean isReservedIdentifier(String targetName); } | AssignmentsInfos { public static ParsedAssignmentsInfo parsed( List<DataInput> datainput, List<DataInputAssociation> inputAssociations, List<DataOutput> dataoutput, List<DataOutputAssociation> outputAssociations, boolean alternativeEncoding) { DeclarationList inputs = dataInputDeclarations(datainput); DeclarationList outputs = dataOutputDeclarations(dataoutput); AssociationList associations = new AssociationList( inAssociationDeclarations(inputAssociations), outAssociationDeclarations(outputAssociations)); return new ParsedAssignmentsInfo( inputs, outputs, associations, alternativeEncoding); } static AssignmentsInfo of(
final List<DataInput> datainput,
final List<DataInputAssociation> inputAssociations,
final List<DataOutput> dataoutput,
final List<DataOutputAssociation> outputAssociations,
boolean alternativeEncoding); static ParsedAssignmentsInfo parsed(
List<DataInput> datainput,
List<DataInputAssociation> inputAssociations,
List<DataOutput> dataoutput,
List<DataOutputAssociation> outputAssociations,
boolean alternativeEncoding); static boolean isReservedDeclaration(DataInput o); static boolean isReservedIdentifier(String targetName); } |
@Test public void testGetAdHocCompletionConditionWithoutFormalExpression() { when(process.getCompletionCondition()).thenReturn(null); assertEquals(new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"), propertyReader.getAdHocCompletionCondition()); } | public ScriptTypeValue getAdHocCompletionCondition() { if (process.getCompletionCondition() instanceof FormalExpression) { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage(), Scripts.LANGUAGE.MVEL.language()), FormalExpressionBodyHandler.of(completionCondition).getBody() ); } else { return new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"); } } | AdHocSubProcessPropertyReader extends SubProcessPropertyReader { public ScriptTypeValue getAdHocCompletionCondition() { if (process.getCompletionCondition() instanceof FormalExpression) { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage(), Scripts.LANGUAGE.MVEL.language()), FormalExpressionBodyHandler.of(completionCondition).getBody() ); } else { return new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"); } } } | AdHocSubProcessPropertyReader extends SubProcessPropertyReader { public ScriptTypeValue getAdHocCompletionCondition() { if (process.getCompletionCondition() instanceof FormalExpression) { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage(), Scripts.LANGUAGE.MVEL.language()), FormalExpressionBodyHandler.of(completionCondition).getBody() ); } else { return new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"); } } AdHocSubProcessPropertyReader(AdHocSubProcess element, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | AdHocSubProcessPropertyReader extends SubProcessPropertyReader { public ScriptTypeValue getAdHocCompletionCondition() { if (process.getCompletionCondition() instanceof FormalExpression) { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage(), Scripts.LANGUAGE.MVEL.language()), FormalExpressionBodyHandler.of(completionCondition).getBody() ); } else { return new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"); } } AdHocSubProcessPropertyReader(AdHocSubProcess element, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getAdHocActivationCondition(); ScriptTypeValue getAdHocCompletionCondition(); String getAdHocOrdering(); boolean isAdHocAutostart(); } | AdHocSubProcessPropertyReader extends SubProcessPropertyReader { public ScriptTypeValue getAdHocCompletionCondition() { if (process.getCompletionCondition() instanceof FormalExpression) { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage(), Scripts.LANGUAGE.MVEL.language()), FormalExpressionBodyHandler.of(completionCondition).getBody() ); } else { return new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"); } } AdHocSubProcessPropertyReader(AdHocSubProcess element, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getAdHocActivationCondition(); ScriptTypeValue getAdHocCompletionCondition(); String getAdHocOrdering(); boolean isAdHocAutostart(); } |
@Test public void testGetOnEntryScript() { OnEntryScriptType onEntryScript = Mockito.mock(OnEntryScriptType.class); when(onEntryScript.getScript()).thenReturn(SCRIPT); when(onEntryScript.getScriptFormat()).thenReturn(JAVA_FORMAT); List<OnEntryScriptType> onEntryScripts = Collections.singletonList(onEntryScript); EList<ExtensionAttributeValue> extensions = mockExtensions(DroolsPackage.Literals.DOCUMENT_ROOT__ON_ENTRY_SCRIPT, onEntryScripts); when(activity.getExtensionValues()).thenReturn(extensions); assertScript(JAVA, SCRIPT, reader.getOnEntryAction()); } | public ScriptTypeListValue getOnEntryAction() { return Scripts.onEntry(element.getExtensionValues()); } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnEntryAction() { return Scripts.onEntry(element.getExtensionValues()); } } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnEntryAction() { return Scripts.onEntry(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnEntryAction() { return Scripts.onEntry(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnEntryAction() { return Scripts.onEntry(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); } |
@Test public void testGetCurrentDiagram() { final DMNDiagramElement diagramElement = new DMNDiagramElement(); final Diagram stunnerDiagram = mock(Diagram.class); final DMNDiagramSelected selectedDiagram = new DMNDiagramSelected(diagramElement); dmnDiagramsSession.add(diagramElement, stunnerDiagram); dmnDiagramsSession.onDMNDiagramSelected(selectedDiagram); final Optional<Diagram> currentDiagram = dmnDiagramsSession.getCurrentDiagram(); assertTrue(currentDiagram.isPresent()); assertEquals(stunnerDiagram, currentDiagram.get()); } | public Optional<Diagram> getCurrentDiagram() { return getSessionState().getCurrentDiagram(); } | DMNDiagramsSession implements GraphsProvider { public Optional<Diagram> getCurrentDiagram() { return getSessionState().getCurrentDiagram(); } } | DMNDiagramsSession implements GraphsProvider { public Optional<Diagram> getCurrentDiagram() { return getSessionState().getCurrentDiagram(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramsSession implements GraphsProvider { public Optional<Diagram> getCurrentDiagram() { return getSessionState().getCurrentDiagram(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } | DMNDiagramsSession implements GraphsProvider { public Optional<Diagram> getCurrentDiagram() { return getSessionState().getCurrentDiagram(); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } |
@Test public void testGetOnExitScript() { OnExitScriptType onExitScript = Mockito.mock(OnExitScriptType.class); when(onExitScript.getScript()).thenReturn(SCRIPT); when(onExitScript.getScriptFormat()).thenReturn(JAVA_FORMAT); List<OnExitScriptType> onExitScripts = Collections.singletonList(onExitScript); EList<ExtensionAttributeValue> extensions = mockExtensions(DroolsPackage.Literals.DOCUMENT_ROOT__ON_EXIT_SCRIPT, onExitScripts); when(activity.getExtensionValues()).thenReturn(extensions); assertScript(JAVA, SCRIPT, reader.getOnExitAction()); } | public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); } } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); } | ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); } |
@Test public void testGetAssignmentsInfo() { EList<DataInput> dataInputs = ECollections.newBasicEList(); DataInput dataInput1 = mockDataInput("INPUT_ID_1", "INPUT_NAME_1", mockEntry("dtype", "Integer")); DataInput dataInput2 = mockDataInput("INPUT_ID_2", "INPUT_NAME_2", mockEntry("dtype", "String")); dataInputs.add(dataInput1); dataInputs.add(dataInput2); InputOutputSpecification ioSpec = mock(InputOutputSpecification.class); EList<DataInputAssociation> dataInputAssociations = ECollections.newBasicEList(); DataInputAssociation inputAssociation = mockDataInputAssociation(dataInput1, "VARIABLE1"); DataInputAssociation inputAssociation2 = mockDataInputAssociation(dataInput2, "VARIABLE2"); dataInputAssociations.add(inputAssociation); dataInputAssociations.add(inputAssociation2); EList<DataOutput> dataOutputs = ECollections.newBasicEList(); DataOutput dataOutput1 = mockDataOutput("OUTPUT_ID_1", "OUTPUT_NAME_1", mockEntry("dtype", "Boolean")); DataOutput dataOutput2 = mockDataOutput("OUTPUT_ID_2", "OUTPUT_NAME_2", mockEntry("dtype", "Float")); dataOutputs.add(dataOutput1); dataOutputs.add(dataOutput2); EList<DataOutputAssociation> dataOutputAssociations = ECollections.newBasicEList(); DataOutputAssociation outputAssociation1 = mockDataOutputAssociation(dataOutput1, "VARIABLE3"); DataOutputAssociation outputAssociation2 = mockDataOutputAssociation(dataOutput2, "VARIABLE4"); dataOutputAssociations.add(outputAssociation1); dataOutputAssociations.add(outputAssociation2); when(ioSpec.getDataInputs()).thenReturn(dataInputs); when(ioSpec.getDataOutputs()).thenReturn(dataOutputs); when(activity.getIoSpecification()).thenReturn(ioSpec); when(activity.getDataInputAssociations()).thenReturn(dataInputAssociations); when(activity.getDataOutputAssociations()).thenReturn(dataOutputAssociations); AssignmentsInfo result = reader.getAssignmentsInfo(); String expectedResult = "|INPUT_NAME_1:Integer,INPUT_NAME_2:String||OUTPUT_NAME_1:Boolean,OUTPUT_NAME_2:Float|[din]VARIABLE1->INPUT_NAME_1,[din]VARIABLE2->INPUT_NAME_2,[dout]OUTPUT_NAME_1->VARIABLE3,[dout]OUTPUT_NAME_2->VARIABLE4"; assertEquals(expectedResult, result.getValue()); } | public AssignmentsInfo getAssignmentsInfo() { AssignmentsInfo info = AssignmentsInfos.of(getDataInputs(), getDataInputAssociations(), getDataOutputs(), getDataOutputAssociations(), getIOSpecification().isPresent()); if (info.getValue().isEmpty()) { info.setValue(EMPTY_ASSIGNMENTS); } return info; } | ActivityPropertyReader extends FlowElementPropertyReader { public AssignmentsInfo getAssignmentsInfo() { AssignmentsInfo info = AssignmentsInfos.of(getDataInputs(), getDataInputAssociations(), getDataOutputs(), getDataOutputAssociations(), getIOSpecification().isPresent()); if (info.getValue().isEmpty()) { info.setValue(EMPTY_ASSIGNMENTS); } return info; } } | ActivityPropertyReader extends FlowElementPropertyReader { public AssignmentsInfo getAssignmentsInfo() { AssignmentsInfo info = AssignmentsInfos.of(getDataInputs(), getDataInputAssociations(), getDataOutputs(), getDataOutputAssociations(), getIOSpecification().isPresent()); if (info.getValue().isEmpty()) { info.setValue(EMPTY_ASSIGNMENTS); } return info; } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | ActivityPropertyReader extends FlowElementPropertyReader { public AssignmentsInfo getAssignmentsInfo() { AssignmentsInfo info = AssignmentsInfos.of(getDataInputs(), getDataInputAssociations(), getDataOutputs(), getDataOutputAssociations(), getIOSpecification().isPresent()); if (info.getValue().isEmpty()) { info.setValue(EMPTY_ASSIGNMENTS); } return info; } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); } | ActivityPropertyReader extends FlowElementPropertyReader { public AssignmentsInfo getAssignmentsInfo() { AssignmentsInfo info = AssignmentsInfos.of(getDataInputs(), getDataInputAssociations(), getDataOutputs(), getDataOutputAssociations(), getIOSpecification().isPresent()); if (info.getValue().isEmpty()) { info.setValue(EMPTY_ASSIGNMENTS); } return info; } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); } |
@Test public void convertBusinessRuleTask() { org.eclipse.bpmn2.BusinessRuleTask task = mock(org.eclipse.bpmn2.BusinessRuleTask.class); BusinessRuleTaskPropertyReader propertyReader = mock(BusinessRuleTaskPropertyReader.class); BusinessRuleTask businessRuleDefinition = new BusinessRuleTask(); when(factoryManager.newNode(anyString(), eq(BusinessRuleTask.class))).thenReturn(businessRuleTaskNode); when(businessRuleTaskNode.getContent()).thenReturn(businessRuleTaskContent); when(businessRuleTaskContent.getDefinition()).thenReturn(businessRuleDefinition); when(propertyReaderFactory.of(task)).thenReturn(propertyReader); final BpmnNode converted = (BpmnNode) tested.convert(task).value(); assertNotEquals(converted.value(), noneTaskNode); assertEquals(converted.value(), businessRuleTaskNode); } | @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); @Override Result<BpmnNode> convert(Task task); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); @Override Result<BpmnNode> convert(Task task); } |
@Test public void convertServiceTask() { org.eclipse.bpmn2.ServiceTask task = mock(org.eclipse.bpmn2.ServiceTask.class); ServiceTaskPropertyReader serviceTaskPropertyReader = mock(ServiceTaskPropertyReader.class); CustomTask definition = new CustomTask(); FeatureMap attributes = mock(FeatureMap.class); FeatureMap.Entry ruleAttr = mock(FeatureMap.Entry.class); EStructuralFeature ruleFeature = mock(EStructuralFeature.class); when(factoryManager.newNode(anyString(), eq(CustomTask.class))).thenReturn(serviceTaskNode); when(serviceTaskNode.getContent()).thenReturn(serviceTaskContent); when(serviceTaskContent.getDefinition()).thenReturn(definition); when(propertyReaderFactory.ofCustom(task)).thenReturn(Optional.of(serviceTaskPropertyReader)); when(task.getAnyAttribute()).thenReturn(attributes); when(attributes.stream()).thenReturn(Stream.of(ruleAttr)); when(ruleAttr.getEStructuralFeature()).thenReturn(ruleFeature); when(ruleAttr.getValue()).thenReturn(""); when(ruleFeature.getName()).thenReturn(CustomAttribute.serviceImplementation.name()); final BpmnNode converted = (BpmnNode) tested.convert(task).value(); assertNotEquals(converted.value(), noneTaskNode); assertEquals(converted.value(), serviceTaskNode); } | @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); @Override Result<BpmnNode> convert(Task task); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); @Override Result<BpmnNode> convert(Task task); } |
@Test public void convertGenericServiceTask() { org.eclipse.bpmn2.ServiceTask task = mock(org.eclipse.bpmn2.ServiceTask.class); GenericServiceTaskPropertyReader genericServiceTaskPropertyReader = mock(GenericServiceTaskPropertyReader.class); GenericServiceTask definition = new GenericServiceTask(); FeatureMap attributes = mock(FeatureMap.class); FeatureMap.Entry ruleAttr = mock(FeatureMap.Entry.class); EStructuralFeature ruleFeature = mock(EStructuralFeature.class); when(factoryManager.newNode(anyString(), eq(GenericServiceTask.class))).thenReturn(genericServiceTaskNode); when(genericServiceTaskNode.getContent()).thenReturn(genericServiceTaskContent); when(genericServiceTaskContent.getDefinition()).thenReturn(definition); when(propertyReaderFactory.of(task)).thenReturn(genericServiceTaskPropertyReader); when(task.getAnyAttribute()).thenReturn(attributes); when(attributes.stream()).thenReturn(Stream.of(ruleAttr)); when(ruleAttr.getEStructuralFeature()).thenReturn(ruleFeature); when(ruleAttr.getValue()).thenReturn("Java"); when(ruleFeature.getName()).thenReturn(CustomAttribute.serviceImplementation.name()); final BpmnNode converted = (BpmnNode) tested.convert(task).value(); assertNotEquals(converted.value(), noneTaskNode); assertEquals(converted.value(), genericServiceTaskNode); } | @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); @Override Result<BpmnNode> convert(Task task); } | BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(Task task) { return Match.<Task, BpmnNode>of() .when(e -> e instanceof org.eclipse.bpmn2.BusinessRuleTask, this::businessRuleTask) .when(e -> e instanceof org.eclipse.bpmn2.ScriptTask, this::scriptTask) .when(e -> e instanceof org.eclipse.bpmn2.UserTask, this::userTask) .when(e -> e instanceof org.eclipse.bpmn2.ServiceTask, this::serviceTaskResolver) .when(e -> org.eclipse.bpmn2.impl.TaskImpl.class.equals(e.getClass()), this::defaultTaskResolver) .missing(e -> e instanceof ManualTask, ManualTask.class) .missing(e -> e instanceof CustomTask, SendTask.class) .missing(e -> e instanceof ReceiveTask, ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); @Override Result<BpmnNode> convert(Task task); } |
@Test public void testConvertEdge() { associationConverter.convertEdge(association, nodes); verify(definition).setGeneral(generalSetCaptor.capture()); assertEquals(ASSOCIATION_DOCUMENTATION, generalSetCaptor.getValue().getDocumentation().getValue()); assertEdgeWithConnections(); } | @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); @Override @SuppressWarnings("unchecked") Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association,
Map<String, BpmnNode> nodes); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); @Override @SuppressWarnings("unchecked") Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association,
Map<String, BpmnNode> nodes); } |
@Test public void testConvertEdgeNonDirectional() { when(factoryManager.newEdge(ASSOCIATION_ID, NonDirectionalAssociation.class)).thenReturn((Edge) edgeNonDirectional); when(associationReader.getAssociationByDirection()).thenAnswer(a -> NonDirectionalAssociation.class); when(edgeNonDirectional.getContent()).thenReturn(contentNonDirectional); when(contentNonDirectional.getDefinition()).thenReturn(definitionNonDirectional); BpmnEdge.Simple result = (BpmnEdge.Simple) associationConverter.convertEdge(association, nodes).value(); assertEquals(edgeNonDirectional, result.getEdge()); } | @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); @Override @SuppressWarnings("unchecked") Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association,
Map<String, BpmnNode> nodes); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); @Override @SuppressWarnings("unchecked") Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association,
Map<String, BpmnNode> nodes); } |
@Test public void testConvertIgnoredEdge() { assertEdgeWithConnections(); nodes.remove(SOURCE_ID); BpmnEdge.Simple result = (BpmnEdge.Simple) associationConverter.convertEdge(association, nodes).value(); assertNull(result); nodes.put(SOURCE_ID, sourceNode); nodes.remove(TARGET_ID); result = (BpmnEdge.Simple) associationConverter.convertEdge(association, nodes).value(); assertNull(result); nodes.put(SOURCE_ID, sourceNode); nodes.put(TARGET_ID, targetNode); assertEdgeWithConnections(); } | @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); @Override @SuppressWarnings("unchecked") Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association,
Map<String, BpmnNode> nodes); } | AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { @Override @SuppressWarnings("unchecked") public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); @Override @SuppressWarnings("unchecked") Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association,
Map<String, BpmnNode> nodes); } |
@Test public void testPostConvert() { DefinitionResolver definitionResolver = mock(DefinitionResolver.class); double laneX = 80; double laneY = 100; double laneWidth = 500; double laneHeight = 200; RectangleDimensionsSet laneRectangleDimensionsSet = new RectangleDimensionsSet(laneWidth, laneHeight); Lane laneDefinition = mock(Lane.class); when(laneDefinition.getDimensionsSet()).thenReturn(laneRectangleDimensionsSet); Node<? extends View<? extends BPMNViewDefinition>, ?> lane = mockNode(laneDefinition, laneX, laneY, laneWidth, laneHeight); BpmnNode laneNode = mockBpmnNode(lane); double startEventX = 180; double startEventY = 130; double eventWidth = 56; double eventHeight = 56; Node<? extends View<? extends BPMNViewDefinition>, ?> startEvent = mockNode(mock(StartNoneEvent.class), startEventX + laneX, startEventY + laneY, eventWidth, eventHeight); BpmnNode startEventNode = mockBpmnNode(startEvent); double subprocessX = 270; double subprocessY = 180; double subprocessWidth = 100; double subprocessHeight = 60; RectangleDimensionsSet subprocessRectangleDimensionsSet = new RectangleDimensionsSet(subprocessWidth, subprocessHeight); EmbeddedSubprocess subprocessDefinition = mock(EmbeddedSubprocess.class); when(subprocessDefinition.getDimensionsSet()).thenReturn(subprocessRectangleDimensionsSet); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess = mockNode(subprocessDefinition, subprocessX + laneX, subprocessY + laneY, subprocessWidth, subprocessHeight); BpmnNode subprocessNode = mockBpmnNode(subprocess); BasePropertyReader subprocessPropertyReader = subprocessNode.getPropertyReader(); when(subprocessPropertyReader.isExpanded()).thenReturn(false); double subprocessBoundaryEventX = subprocessWidth - 28; double subprocessBoundaryEventY = (subprocessHeight / 2) - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> subprocessBoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), subprocessBoundaryEventX, subprocessBoundaryEventY, eventWidth, eventHeight); BpmnNode subprocessBoundaryEventNode = mockBpmnNode(subprocessBoundaryEvent).docked(); double task1X = 10; double task1Y = 10; double taskWidth = 200; double taskHeight = 100; Node<? extends View<? extends BPMNViewDefinition>, ?> task1 = mockNode(mock(UserTask.class), task1X, task1Y, taskWidth, taskHeight); BpmnNode task1Node = mockBpmnNode(task1); double task2X = 300; double task2Y = 200; Node<? extends View<? extends BPMNViewDefinition>, ?> task2 = mockNode(mock(UserTask.class), task2X, task2Y, taskWidth, taskHeight); BpmnNode task2Node = mockBpmnNode(task2); double task2BoundaryEventX = taskWidth - 28; double task2BoundaryEventY = taskHeight - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> task2BoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), task2BoundaryEventX, task2BoundaryEventY, eventWidth, eventHeight); BpmnNode task2BoundaryEventNode = mockBpmnNode(task2BoundaryEvent).docked(); double endEventX = 450; double endEventY = 230; Node<? extends View<? extends BPMNViewDefinition>, ?> endEvent = mockNode(mock(EndNoneEvent.class), endEventX + laneX, endEventY + laneY, eventWidth, eventHeight); BpmnNode endEventNode = mockBpmnNode(endEvent); double task3X = 500; double task3Y = 600; Node<? extends View<? extends BPMNViewDefinition>, ?> task3 = mockNode(mock(UserTask.class), task3X + laneX, task3Y + laneY, taskWidth, taskHeight); BpmnNode task3Node = mockBpmnNode(task3); double task3BoundaryEventX = taskWidth - 28; double task3BoundaryEventY = taskHeight - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> task3BoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), task3BoundaryEventX, task3BoundaryEventY, eventWidth, eventHeight); BpmnNode task3BoundaryEventNode = mockBpmnNode(task3BoundaryEvent).docked(); double task4X = 900; double task4Y = 1000; Node<? extends View<? extends BPMNViewDefinition>, ?> task4 = mockNode(mock(UserTask.class), task4X + laneX, task4Y + laneY, taskWidth, taskHeight); BpmnNode task4Node = mockBpmnNode(task4); List<Point2D> controlPoints = new ArrayList<>(); controlPoints.add(Point2D.create(900 + 100 + laneX, 700 + laneY)); Connection sourceConnection = MagnetConnection.Builder.at(56, 28).setAuto(false); Connection targetConnection = MagnetConnection.Builder.at(100, 0).setAuto(false); BPMNEdge bpmnEdge = mock(BPMNEdge.class); BaseElement baseElement = mock(BaseElement.class); SequenceFlowPropertyReader edgePropertyReader = mock(SequenceFlowPropertyReader.class); when(edgePropertyReader.getDefinitionResolver()).thenReturn(definitionResolver); when(edgePropertyReader.getElement()).thenReturn(baseElement); when(baseElement.getId()).thenReturn("elementId"); when(definitionResolver.getEdge("elementId")).thenReturn(bpmnEdge); EList<Point> wayPoints = ECollections.newBasicEList(); wayPoints.add(mockPoint((float) (700 + 28 + laneX), (float) (700 + laneY))); wayPoints.add(mockPoint((float) (1000 + laneX), (float) (700 + laneY))); wayPoints.add(mockPoint((float) (900 + 100 + laneX), (float) (1000 + laneY))); when(bpmnEdge.getWaypoint()).thenReturn(wayPoints); org.eclipse.dd.dc.Bounds sourceShapeBounds = mockBounds((float) (task3X + taskWidth - 28 + laneX), (float) (task3Y + taskHeight - 28 + laneY), (float) eventWidth, (float) eventHeight); BPMNShape sourceShape = mockShape(sourceShapeBounds); when(task3BoundaryEventNode.getPropertyReader().getShape()).thenReturn(sourceShape); org.eclipse.dd.dc.Bounds targetShapeBounds = mockBounds(task4.getContent().getBounds()); BPMNShape targetShape = mockShape(targetShapeBounds); when(task4Node.getPropertyReader().getShape()).thenReturn(targetShape); BpmnEdge.Simple edgeTask3BoundaryEventToTask4 = BpmnEdge.of(null, task3BoundaryEventNode, sourceConnection, controlPoints, task4Node, targetConnection, edgePropertyReader); Node<? extends View<? extends BPMNViewDefinition>, ?> diagram = mockNode(mock(BPMNDiagramImpl.class), 0, 0, 10000, 10000); BpmnNode rootNode = mockBpmnNode(diagram); rootNode.addChild(laneNode); laneNode.addChild(startEventNode); laneNode.addChild(subprocessNode); laneNode.addChild(subprocessBoundaryEventNode); rootNode.addEdge(BpmnEdge.docked(subprocessNode, subprocessBoundaryEventNode)); subprocessNode.addChild(task1Node); subprocessNode.addChild(task2Node); subprocessNode.addChild(task2BoundaryEventNode); subprocessNode.addEdge(BpmnEdge.docked(task2Node, task2BoundaryEventNode)); laneNode.addChild(task3Node); laneNode.addChild(task3BoundaryEventNode); laneNode.addChild(task4Node); rootNode.addEdge(BpmnEdge.docked(task3Node, task3BoundaryEventNode)); rootNode.addEdge(edgeTask3BoundaryEventToTask4); laneNode.addChild(endEventNode); ProcessPostConverter postConverter = new ProcessPostConverter(); when(definitionResolver.getResolutionFactor()).thenReturn(2d); Result<BpmnNode> result = postConverter.postConvert(rootNode, definitionResolver); Bounds startEventBounds = startEventNode.value().getContent().getBounds(); assertEquals(laneX + startEventX, startEventBounds.getUpperLeft().getX(), 0); assertEquals(laneY + startEventY, startEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, startEventBounds.getWidth(), 0); assertEquals(eventHeight, startEventBounds.getHeight(), 0); Bounds subProcessBounds = subprocessNode.value().getContent().getBounds(); assertEquals(laneX + subprocessX, subProcessBounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY, subProcessBounds.getUpperLeft().getY(), 0); assertEquals(300 + 200 + 10, subProcessBounds.getWidth(), 0); assertEquals(200 + 100 + 10, subProcessBounds.getHeight(), 0); Bounds subProcessBoundaryEventBounds = subprocessBoundaryEventNode.value().getContent().getBounds(); assertEquals(subProcessBounds.getWidth() - 28, subProcessBoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(subProcessBounds.getHeight() / subprocessHeight * subprocessBoundaryEventY, subProcessBoundaryEventBounds.getUpperLeft().getY(), 0); Bounds task1Bounds = task1Node.value().getContent().getBounds(); assertEquals(laneX + subprocessX + task1X, task1Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY + task1Y, task1Bounds.getUpperLeft().getY(), 0); assertEquals(taskWidth, task1Bounds.getWidth(), 0); assertEquals(taskHeight, task1Bounds.getHeight(), 0); Bounds task2Bounds = task2Node.value().getContent().getBounds(); assertEquals(laneX + subprocessX + task2X, task2Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY + task2Y, task2Bounds.getUpperLeft().getY(), 0); assertEquals(taskWidth, task1Bounds.getWidth(), 0); assertEquals(taskHeight, task1Bounds.getHeight(), 0); Bounds task2BoundaryEventBounds = task2BoundaryEventNode.value().getContent().getBounds(); assertEquals(task2BoundaryEventX, task2BoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(task2BoundaryEventY, task2BoundaryEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, task2BoundaryEventBounds.getWidth(), 0); assertEquals(eventHeight, task2BoundaryEventBounds.getHeight(), 0); Bounds endEventBounds = endEventNode.value().getContent().getBounds(); double subprocessDeltaX = subProcessBounds.getWidth() - subprocessWidth; double subprocessDeltaY = subProcessBounds.getHeight() - subprocessHeight; assertEquals(laneX + endEventX + subprocessDeltaX, endEventBounds.getUpperLeft().getX(), 0); assertEquals(laneY + endEventY + subprocessDeltaY, endEventBounds.getUpperLeft().getY(), 0); Bounds task3Bounds = task3Node.value().getContent().getBounds(); assertEquals(laneX + task3X + subprocessDeltaX, task3Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + task3Y + subprocessDeltaY, task3Bounds.getUpperLeft().getY(), 0); Bounds task3BoundaryEventBounds = task3BoundaryEventNode.value().getContent().getBounds(); assertEquals(task3BoundaryEventX, task3BoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(task3BoundaryEventY, task3BoundaryEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, task3BoundaryEventBounds.getWidth(), 0); assertEquals(eventHeight, task3BoundaryEventBounds.getHeight(), 0); Bounds task4Bounds = task4Node.value().getContent().getBounds(); assertEquals(laneX + task4X + subprocessDeltaX, task4Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + task4Y + subprocessDeltaY, task4Bounds.getUpperLeft().getY(), 0); assertEquals(56, edgeTask3BoundaryEventToTask4.getSourceConnection().getLocation().getX(), 0); assertEquals(28, edgeTask3BoundaryEventToTask4.getSourceConnection().getLocation().getY(), 0); assertEquals(task4Node.value().getContent().getBounds().getUpperLeft().getX() + taskWidth / 2, controlPoints.get(0).getX(), 0); assertEquals(task3Node.value().getContent().getBounds().getLowerRight().getY(), controlPoints.get(0).getY(), 0); List<MarshallingMessage> messages = result.messages(); assertEquals(1, messages.size()); MarshallingMessage message = messages.get(0); assertEquals(Violation.Type.WARNING, message.getViolationType()); assertEquals(MarshallingMessageKeys.collapsedElementExpanded, message.getMessageKey()); } | public Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver) { if (definitionResolver.getResolutionFactor() != 1) { context = PostConverterContext.of(rootNode, definitionResolver.isJbpm()); adjustAllEdgeConnections(rootNode, true); if (context.hasCollapsedNodes()) { List<LaneInfo> laneInfos = new ArrayList<>(); new ArrayList<>(rootNode.getChildren()).stream() .filter(ProcessPostConverter::isLane) .filter(BpmnNode::hasChildren) .forEach(lane -> { LaneInfo laneInfo = new LaneInfo(lane, Padding.of(lane), new ArrayList<>(lane.getChildren())); laneInfos.add(laneInfo); laneInfo.getChildren().forEach(child -> child.setParent(rootNode)); rootNode.removeChild(lane); }); rootNode.getChildren().stream() .filter(ProcessPostConverter::isSubProcess) .forEach(this::postConvertSubProcess); List<BpmnNode> resizedChildren = context.getResizedChildren(rootNode); resizedChildren.forEach(resizedChild -> applyNodeResize(rootNode, resizedChild)); laneInfos.forEach(laneInfo -> { laneInfo.getLane().setParent(rootNode); laneInfo.getChildren().forEach(node -> node.setParent(laneInfo.getLane())); adjustLane(laneInfo.getLane(), laneInfo.getPadding()); }); adjustAllEdgeConnections(rootNode, false); return Result.success(rootNode, resizedChildren.stream() .map(n -> MarshallingMessage.builder() .message("Collapsed node was resized " + n.value().getContent().getDefinition()) .messageKey(MarshallingMessageKeys.collapsedElementExpanded) .messageArguments(n.value().getUUID(), Optional.ofNullable(n.value()) .map(Node::getContent) .map(View::getDefinition) .map(BPMNViewDefinition::getGeneral) .map(BPMNBaseInfo::getName) .map(Name::getValue) .orElse("")) .type(Violation.Type.WARNING) .build()) .toArray(MarshallingMessage[]::new)); } } return Result.success(rootNode); } | ProcessPostConverter { public Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver) { if (definitionResolver.getResolutionFactor() != 1) { context = PostConverterContext.of(rootNode, definitionResolver.isJbpm()); adjustAllEdgeConnections(rootNode, true); if (context.hasCollapsedNodes()) { List<LaneInfo> laneInfos = new ArrayList<>(); new ArrayList<>(rootNode.getChildren()).stream() .filter(ProcessPostConverter::isLane) .filter(BpmnNode::hasChildren) .forEach(lane -> { LaneInfo laneInfo = new LaneInfo(lane, Padding.of(lane), new ArrayList<>(lane.getChildren())); laneInfos.add(laneInfo); laneInfo.getChildren().forEach(child -> child.setParent(rootNode)); rootNode.removeChild(lane); }); rootNode.getChildren().stream() .filter(ProcessPostConverter::isSubProcess) .forEach(this::postConvertSubProcess); List<BpmnNode> resizedChildren = context.getResizedChildren(rootNode); resizedChildren.forEach(resizedChild -> applyNodeResize(rootNode, resizedChild)); laneInfos.forEach(laneInfo -> { laneInfo.getLane().setParent(rootNode); laneInfo.getChildren().forEach(node -> node.setParent(laneInfo.getLane())); adjustLane(laneInfo.getLane(), laneInfo.getPadding()); }); adjustAllEdgeConnections(rootNode, false); return Result.success(rootNode, resizedChildren.stream() .map(n -> MarshallingMessage.builder() .message("Collapsed node was resized " + n.value().getContent().getDefinition()) .messageKey(MarshallingMessageKeys.collapsedElementExpanded) .messageArguments(n.value().getUUID(), Optional.ofNullable(n.value()) .map(Node::getContent) .map(View::getDefinition) .map(BPMNViewDefinition::getGeneral) .map(BPMNBaseInfo::getName) .map(Name::getValue) .orElse("")) .type(Violation.Type.WARNING) .build()) .toArray(MarshallingMessage[]::new)); } } return Result.success(rootNode); } } | ProcessPostConverter { public Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver) { if (definitionResolver.getResolutionFactor() != 1) { context = PostConverterContext.of(rootNode, definitionResolver.isJbpm()); adjustAllEdgeConnections(rootNode, true); if (context.hasCollapsedNodes()) { List<LaneInfo> laneInfos = new ArrayList<>(); new ArrayList<>(rootNode.getChildren()).stream() .filter(ProcessPostConverter::isLane) .filter(BpmnNode::hasChildren) .forEach(lane -> { LaneInfo laneInfo = new LaneInfo(lane, Padding.of(lane), new ArrayList<>(lane.getChildren())); laneInfos.add(laneInfo); laneInfo.getChildren().forEach(child -> child.setParent(rootNode)); rootNode.removeChild(lane); }); rootNode.getChildren().stream() .filter(ProcessPostConverter::isSubProcess) .forEach(this::postConvertSubProcess); List<BpmnNode> resizedChildren = context.getResizedChildren(rootNode); resizedChildren.forEach(resizedChild -> applyNodeResize(rootNode, resizedChild)); laneInfos.forEach(laneInfo -> { laneInfo.getLane().setParent(rootNode); laneInfo.getChildren().forEach(node -> node.setParent(laneInfo.getLane())); adjustLane(laneInfo.getLane(), laneInfo.getPadding()); }); adjustAllEdgeConnections(rootNode, false); return Result.success(rootNode, resizedChildren.stream() .map(n -> MarshallingMessage.builder() .message("Collapsed node was resized " + n.value().getContent().getDefinition()) .messageKey(MarshallingMessageKeys.collapsedElementExpanded) .messageArguments(n.value().getUUID(), Optional.ofNullable(n.value()) .map(Node::getContent) .map(View::getDefinition) .map(BPMNViewDefinition::getGeneral) .map(BPMNBaseInfo::getName) .map(Name::getValue) .orElse("")) .type(Violation.Type.WARNING) .build()) .toArray(MarshallingMessage[]::new)); } } return Result.success(rootNode); } ProcessPostConverter(); } | ProcessPostConverter { public Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver) { if (definitionResolver.getResolutionFactor() != 1) { context = PostConverterContext.of(rootNode, definitionResolver.isJbpm()); adjustAllEdgeConnections(rootNode, true); if (context.hasCollapsedNodes()) { List<LaneInfo> laneInfos = new ArrayList<>(); new ArrayList<>(rootNode.getChildren()).stream() .filter(ProcessPostConverter::isLane) .filter(BpmnNode::hasChildren) .forEach(lane -> { LaneInfo laneInfo = new LaneInfo(lane, Padding.of(lane), new ArrayList<>(lane.getChildren())); laneInfos.add(laneInfo); laneInfo.getChildren().forEach(child -> child.setParent(rootNode)); rootNode.removeChild(lane); }); rootNode.getChildren().stream() .filter(ProcessPostConverter::isSubProcess) .forEach(this::postConvertSubProcess); List<BpmnNode> resizedChildren = context.getResizedChildren(rootNode); resizedChildren.forEach(resizedChild -> applyNodeResize(rootNode, resizedChild)); laneInfos.forEach(laneInfo -> { laneInfo.getLane().setParent(rootNode); laneInfo.getChildren().forEach(node -> node.setParent(laneInfo.getLane())); adjustLane(laneInfo.getLane(), laneInfo.getPadding()); }); adjustAllEdgeConnections(rootNode, false); return Result.success(rootNode, resizedChildren.stream() .map(n -> MarshallingMessage.builder() .message("Collapsed node was resized " + n.value().getContent().getDefinition()) .messageKey(MarshallingMessageKeys.collapsedElementExpanded) .messageArguments(n.value().getUUID(), Optional.ofNullable(n.value()) .map(Node::getContent) .map(View::getDefinition) .map(BPMNViewDefinition::getGeneral) .map(BPMNBaseInfo::getName) .map(Name::getValue) .orElse("")) .type(Violation.Type.WARNING) .build()) .toArray(MarshallingMessage[]::new)); } } return Result.success(rootNode); } ProcessPostConverter(); Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver); } | ProcessPostConverter { public Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver) { if (definitionResolver.getResolutionFactor() != 1) { context = PostConverterContext.of(rootNode, definitionResolver.isJbpm()); adjustAllEdgeConnections(rootNode, true); if (context.hasCollapsedNodes()) { List<LaneInfo> laneInfos = new ArrayList<>(); new ArrayList<>(rootNode.getChildren()).stream() .filter(ProcessPostConverter::isLane) .filter(BpmnNode::hasChildren) .forEach(lane -> { LaneInfo laneInfo = new LaneInfo(lane, Padding.of(lane), new ArrayList<>(lane.getChildren())); laneInfos.add(laneInfo); laneInfo.getChildren().forEach(child -> child.setParent(rootNode)); rootNode.removeChild(lane); }); rootNode.getChildren().stream() .filter(ProcessPostConverter::isSubProcess) .forEach(this::postConvertSubProcess); List<BpmnNode> resizedChildren = context.getResizedChildren(rootNode); resizedChildren.forEach(resizedChild -> applyNodeResize(rootNode, resizedChild)); laneInfos.forEach(laneInfo -> { laneInfo.getLane().setParent(rootNode); laneInfo.getChildren().forEach(node -> node.setParent(laneInfo.getLane())); adjustLane(laneInfo.getLane(), laneInfo.getPadding()); }); adjustAllEdgeConnections(rootNode, false); return Result.success(rootNode, resizedChildren.stream() .map(n -> MarshallingMessage.builder() .message("Collapsed node was resized " + n.value().getContent().getDefinition()) .messageKey(MarshallingMessageKeys.collapsedElementExpanded) .messageArguments(n.value().getUUID(), Optional.ofNullable(n.value()) .map(Node::getContent) .map(View::getDefinition) .map(BPMNViewDefinition::getGeneral) .map(BPMNBaseInfo::getName) .map(Name::getValue) .orElse("")) .type(Violation.Type.WARNING) .build()) .toArray(MarshallingMessage[]::new)); } } return Result.success(rootNode); } ProcessPostConverter(); Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver); } |
@Test public void testBoundsCalculation() { double subprocess1X = 10; double subprocess1Y = 10; double subprocess1Width = 100; double subprocess1Height = 200; EmbeddedSubprocess subprocess1Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess1 = mockNode(subprocess1Definition, subprocess1X, subprocess1Y, subprocess1Width, subprocess1Height); when(subprocess1.getUUID()).thenReturn(SUBPROCESS1_ID); BpmnNode subprocess1Node = mockBpmnNode(subprocess1); double subprocess2X = 20; double subprocess2Y = 20; double subprocess2Width = 70; double subprocess2Height = 170; EmbeddedSubprocess subprocess2Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess2 = mockNode(subprocess2Definition, subprocess1X + subprocess2X, subprocess1Y + subprocess2Y, subprocess2Width, subprocess2Height); when(subprocess2.getUUID()).thenReturn(SUBPROCESS2_ID); BpmnNode subprocess2Node = mockBpmnNode(subprocess2); double subprocess3X = 30; double subprocess3Y = 30; double subprocess3Width = 30; double subprocess3Height = 120; EmbeddedSubprocess subprocess3Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess3 = mockNode(subprocess3Definition, subprocess1X + subprocess2X + subprocess3X, subprocess1Y + subprocess2Y + subprocess3Y, subprocess3Width, subprocess3Height); when(subprocess3.getUUID()).thenReturn(SUBPROCESS3_ID); BpmnNode subprocess3Node = mockBpmnNode(subprocess3); Node<? extends View<? extends BPMNViewDefinition>, ?> rootDiagram = mockNode(mock(BPMNDiagramImpl.class), 0, 0, 1000, 1000); when(rootDiagram.getUUID()).thenReturn(DIAGRAM_UUID); BpmnNode rootNode = mockBpmnNode(rootDiagram); subprocess1Node.setParent(rootNode); subprocess2Node.setParent(subprocess1Node); subprocess3Node.setParent(subprocess2Node); graphBuilder.buildGraph(rootNode); assertNodePosition(SUBPROCESS1_ID, subprocess1X, subprocess1Y); assertNodePosition(SUBPROCESS2_ID, subprocess2X, subprocess2Y); assertNodePosition(SUBPROCESS3_ID, subprocess3X, subprocess3Y); } | public void buildGraph(BpmnNode rootNode) { this.addNode(rootNode.value()); rootNode.getEdges().forEach(this::addEdge); List<BpmnNode> nodes = rootNode.getChildren(); Deque<BpmnNode> workingSet = new ArrayDeque<>(prioritized(nodes)); Set<BpmnNode> workedOff = new HashSet<>(); while (!workingSet.isEmpty()) { BpmnNode current = workingSet.pop(); if (workedOff.contains(current)) { continue; } workedOff.add(current); workingSet.addAll( prioritized(current.getChildren())); this.addChildNode(current); current.getEdges().forEach(this::addEdge); } } | GraphBuilder { public void buildGraph(BpmnNode rootNode) { this.addNode(rootNode.value()); rootNode.getEdges().forEach(this::addEdge); List<BpmnNode> nodes = rootNode.getChildren(); Deque<BpmnNode> workingSet = new ArrayDeque<>(prioritized(nodes)); Set<BpmnNode> workedOff = new HashSet<>(); while (!workingSet.isEmpty()) { BpmnNode current = workingSet.pop(); if (workedOff.contains(current)) { continue; } workedOff.add(current); workingSet.addAll( prioritized(current.getChildren())); this.addChildNode(current); current.getEdges().forEach(this::addEdge); } } } | GraphBuilder { public void buildGraph(BpmnNode rootNode) { this.addNode(rootNode.value()); rootNode.getEdges().forEach(this::addEdge); List<BpmnNode> nodes = rootNode.getChildren(); Deque<BpmnNode> workingSet = new ArrayDeque<>(prioritized(nodes)); Set<BpmnNode> workedOff = new HashSet<>(); while (!workingSet.isEmpty()) { BpmnNode current = workingSet.pop(); if (workedOff.contains(current)) { continue; } workedOff.add(current); workingSet.addAll( prioritized(current.getChildren())); this.addChildNode(current); current.getEdges().forEach(this::addEdge); } } GraphBuilder(
Graph<DefinitionSet, Node> graph,
DefinitionManager definitionManager,
TypedFactoryManager typedFactoryManager,
RuleManager ruleManager,
GraphCommandFactory commandFactory,
GraphCommandManager commandManager); } | GraphBuilder { public void buildGraph(BpmnNode rootNode) { this.addNode(rootNode.value()); rootNode.getEdges().forEach(this::addEdge); List<BpmnNode> nodes = rootNode.getChildren(); Deque<BpmnNode> workingSet = new ArrayDeque<>(prioritized(nodes)); Set<BpmnNode> workedOff = new HashSet<>(); while (!workingSet.isEmpty()) { BpmnNode current = workingSet.pop(); if (workedOff.contains(current)) { continue; } workedOff.add(current); workingSet.addAll( prioritized(current.getChildren())); this.addChildNode(current); current.getEdges().forEach(this::addEdge); } } GraphBuilder(
Graph<DefinitionSet, Node> graph,
DefinitionManager definitionManager,
TypedFactoryManager typedFactoryManager,
RuleManager ruleManager,
GraphCommandFactory commandFactory,
GraphCommandManager commandManager); void render(BpmnNode root); void buildGraph(BpmnNode rootNode); } | GraphBuilder { public void buildGraph(BpmnNode rootNode) { this.addNode(rootNode.value()); rootNode.getEdges().forEach(this::addEdge); List<BpmnNode> nodes = rootNode.getChildren(); Deque<BpmnNode> workingSet = new ArrayDeque<>(prioritized(nodes)); Set<BpmnNode> workedOff = new HashSet<>(); while (!workingSet.isEmpty()) { BpmnNode current = workingSet.pop(); if (workedOff.contains(current)) { continue; } workedOff.add(current); workingSet.addAll( prioritized(current.getChildren())); this.addChildNode(current); current.getEdges().forEach(this::addEdge); } } GraphBuilder(
Graph<DefinitionSet, Node> graph,
DefinitionManager definitionManager,
TypedFactoryManager typedFactoryManager,
RuleManager ruleManager,
GraphCommandFactory commandFactory,
GraphCommandManager commandManager); void render(BpmnNode root); void buildGraph(BpmnNode rootNode); } |
@Test public void testGetDRGDiagram() { final Diagram expected = mock(Diagram.class); doReturn(expected).when(dmnDiagramsSessionState).getDRGDiagram(); final Diagram actual = dmnDiagramsSession.getDRGDiagram(); assertEquals(expected, actual); } | public Diagram getDRGDiagram() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagram).orElse(null); } | DMNDiagramsSession implements GraphsProvider { public Diagram getDRGDiagram() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagram).orElse(null); } } | DMNDiagramsSession implements GraphsProvider { public Diagram getDRGDiagram() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagram).orElse(null); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramsSession implements GraphsProvider { public Diagram getDRGDiagram() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagram).orElse(null); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } | DMNDiagramsSession implements GraphsProvider { public Diagram getDRGDiagram() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagram).orElse(null); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } |
@Test public void testGetNodes() { final DRGElement drgElement = mock(DRGElement.class); final List<DRGElement> expectedNodes = singletonList(drgElement); when(dmnDiagramUtils.getDRGElements(diagram)).thenReturn(expectedNodes); final List<DRGElement> actualNodes = helper.getNodes(diagram); assertEquals(expectedNodes, actualNodes); } | public List<DRGElement> getNodes(final Diagram diagram) { return dmnDiagramUtils.getDRGElements(diagram); } | DMNDiagramHelper { public List<DRGElement> getNodes(final Diagram diagram) { return dmnDiagramUtils.getDRGElements(diagram); } } | DMNDiagramHelper { public List<DRGElement> getNodes(final Diagram diagram) { return dmnDiagramUtils.getDRGElements(diagram); } @Inject DMNDiagramHelper(final DiagramService diagramService,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramHelper { public List<DRGElement> getNodes(final Diagram diagram) { return dmnDiagramUtils.getDRGElements(diagram); } @Inject DMNDiagramHelper(final DiagramService diagramService,
final DMNDiagramUtils dmnDiagramUtils); List<DRGElement> getNodes(final Diagram diagram); List<ItemDefinition> getItemDefinitions(final Diagram diagram); String getNamespace(final Path path); String getNamespace(final Diagram diagram); Diagram<Graph, Metadata> getDiagramByPath(final Path path); } | DMNDiagramHelper { public List<DRGElement> getNodes(final Diagram diagram) { return dmnDiagramUtils.getDRGElements(diagram); } @Inject DMNDiagramHelper(final DiagramService diagramService,
final DMNDiagramUtils dmnDiagramUtils); List<DRGElement> getNodes(final Diagram diagram); List<ItemDefinition> getItemDefinitions(final Diagram diagram); String getNamespace(final Path path); String getNamespace(final Diagram diagram); Diagram<Graph, Metadata> getDiagramByPath(final Path path); } |
@Test public void testGetShape() { BPMNShape shape = mock(BPMNShape.class); BaseElement bpmnElement = mock(BaseElement.class); when(shape.getBpmnElement()).thenReturn(bpmnElement); when(bpmnElement.getId()).thenReturn(ID); planeElements.add(shape); assertEquals(shape, definitionResolver.getShape(ID)); } | public BPMNShape getShape(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getShape(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } | DefinitionResolver { public BPMNShape getShape(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getShape(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } } | DefinitionResolver { public BPMNShape getShape(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getShape(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); } | DefinitionResolver { public BPMNShape getShape(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getShape(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); } | DefinitionResolver { public BPMNShape getShape(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getShape(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); } |
@Test public void testGetEdge() { BPMNEdge edge = mock(BPMNEdge.class); BaseElement bpmnElement = mock(BaseElement.class); when(edge.getBpmnElement()).thenReturn(bpmnElement); when(bpmnElement.getId()).thenReturn(ID); planeElements.add(edge); assertEquals(edge, definitionResolver.getEdge(ID)); } | public BPMNEdge getEdge(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getEdge(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } | DefinitionResolver { public BPMNEdge getEdge(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getEdge(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } } | DefinitionResolver { public BPMNEdge getEdge(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getEdge(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); } | DefinitionResolver { public BPMNEdge getEdge(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getEdge(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); } | DefinitionResolver { public BPMNEdge getEdge(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getEdge(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); } |
@Test public void testSimulation() { String elementRef = "some_element_ref"; EList<Scenario> scenarios = ECollections.newBasicEList(); Scenario scenario = mock(Scenario.class); scenarios.add(scenario); EList<ElementParameters> parameters = ECollections.newBasicEList(); ElementParameters parameter = mock(ElementParameters.class); when(parameter.getElementRef()).thenReturn(elementRef); parameters.add(parameter); when(scenario.getElementParameters()).thenReturn(parameters); BPSimDataType simDataType = mock(BPSimDataType.class); simData.add(simDataType); when(simDataType.getScenario()).thenReturn(scenarios); setUp(); assertEquals(parameter, definitionResolver.resolveSimulationParameters(elementRef).get()); } | public Optional<ElementParameters> resolveSimulationParameters(String id) { return Optional.ofNullable(simulationParameters.get(id)); } | DefinitionResolver { public Optional<ElementParameters> resolveSimulationParameters(String id) { return Optional.ofNullable(simulationParameters.get(id)); } } | DefinitionResolver { public Optional<ElementParameters> resolveSimulationParameters(String id) { return Optional.ofNullable(simulationParameters.get(id)); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); } | DefinitionResolver { public Optional<ElementParameters> resolveSimulationParameters(String id) { return Optional.ofNullable(simulationParameters.get(id)); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); } | DefinitionResolver { public Optional<ElementParameters> resolveSimulationParameters(String id) { return Optional.ofNullable(simulationParameters.get(id)); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); } |
@Test public void convertSupported() { StartEvent startEvent = mock(StartEvent.class); tested.convertNode(startEvent); verify(startEventConverter).convert(startEvent); EndEvent endEvent = mock(EndEvent.class); tested.convertNode(endEvent); verify(endEventConverter).convert(endEvent); BoundaryEvent boundaryEvent = mock(BoundaryEvent.class); tested.convertNode(boundaryEvent); verify(eventConverter).convertBoundaryEvent(boundaryEvent); IntermediateCatchEvent intermediateCatchEvent = mock(IntermediateCatchEvent.class); tested.convertNode(intermediateCatchEvent); verify(eventConverter).convert(intermediateCatchEvent); IntermediateThrowEvent intermediateThrowEvent = mock(IntermediateThrowEvent.class); tested.convertNode(intermediateThrowEvent); verify(throwEventConverter).convert(intermediateThrowEvent); Task task = mock(Task.class); tested.convertNode(task); verify(taskConverter).convert(task); Gateway gateway = mock(Gateway.class); tested.convertNode(gateway); verify(gatewayConverter).convert(gateway); SubProcess subProcess = mock(SubProcess.class); tested.convertNode(subProcess); verify(subProcessConverter).convertSubProcess(subProcess); CallActivity callActivity = mock(CallActivity.class); tested.convertNode(callActivity); verify(callActivityConverter).convert(callActivity); TextAnnotation textAnnotation = mock(TextAnnotation.class); tested.convertNode(textAnnotation); verify(textAnnotationConverter).convert(textAnnotation); DataObjectReference dataObjectReference = mock(DataObjectReference.class); tested.convertNode(dataObjectReference); verify(dataObjectConverter).convert(dataObjectReference); } | public Result<BpmnNode> convertNode(FlowElement flowElement) { return Match.<FlowElement, Result<BpmnNode>>of() .<StartEvent>when(e -> e instanceof StartEvent, converterFactory.startEventConverter()::convert) .<EndEvent>when(e -> e instanceof EndEvent, converterFactory.endEventConverter()::convert) .<BoundaryEvent>when(e -> e instanceof BoundaryEvent, converterFactory.intermediateCatchEventConverter()::convertBoundaryEvent) .<IntermediateCatchEvent>when(e -> e instanceof IntermediateCatchEvent, converterFactory.intermediateCatchEventConverter()::convert) .<IntermediateThrowEvent>when(e -> e instanceof IntermediateThrowEvent, converterFactory.intermediateThrowEventConverter()::convert) .<Task>when(e -> e instanceof Task, converterFactory.taskConverter()::convert) .<Gateway>when(e -> e instanceof Gateway, converterFactory.gatewayConverter()::convert) .<SubProcess>when(e -> e instanceof SubProcess, converterFactory.subProcessConverter()::convertSubProcess) .<CallActivity>when(e -> e instanceof CallActivity, converterFactory.callActivityConverter()::convert) .<TextAnnotation>when(e -> e instanceof TextAnnotation, converterFactory.textAnnotationConverter()::convert) .<DataObjectReference>when(e -> e instanceof DataObjectReference, converterFactory.dataObjectConverter()::convert) .ignore(e -> e instanceof DataStoreReference, DataStoreReference.class) .ignore(e -> e instanceof DataObject, DataObject.class) .defaultValue(Result.ignored("FlowElement not found", getNotFoundMessage(flowElement))) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(flowElement) .value(); } | FlowElementConverter extends AbstractConverter { public Result<BpmnNode> convertNode(FlowElement flowElement) { return Match.<FlowElement, Result<BpmnNode>>of() .<StartEvent>when(e -> e instanceof StartEvent, converterFactory.startEventConverter()::convert) .<EndEvent>when(e -> e instanceof EndEvent, converterFactory.endEventConverter()::convert) .<BoundaryEvent>when(e -> e instanceof BoundaryEvent, converterFactory.intermediateCatchEventConverter()::convertBoundaryEvent) .<IntermediateCatchEvent>when(e -> e instanceof IntermediateCatchEvent, converterFactory.intermediateCatchEventConverter()::convert) .<IntermediateThrowEvent>when(e -> e instanceof IntermediateThrowEvent, converterFactory.intermediateThrowEventConverter()::convert) .<Task>when(e -> e instanceof Task, converterFactory.taskConverter()::convert) .<Gateway>when(e -> e instanceof Gateway, converterFactory.gatewayConverter()::convert) .<SubProcess>when(e -> e instanceof SubProcess, converterFactory.subProcessConverter()::convertSubProcess) .<CallActivity>when(e -> e instanceof CallActivity, converterFactory.callActivityConverter()::convert) .<TextAnnotation>when(e -> e instanceof TextAnnotation, converterFactory.textAnnotationConverter()::convert) .<DataObjectReference>when(e -> e instanceof DataObjectReference, converterFactory.dataObjectConverter()::convert) .ignore(e -> e instanceof DataStoreReference, DataStoreReference.class) .ignore(e -> e instanceof DataObject, DataObject.class) .defaultValue(Result.ignored("FlowElement not found", getNotFoundMessage(flowElement))) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(flowElement) .value(); } } | FlowElementConverter extends AbstractConverter { public Result<BpmnNode> convertNode(FlowElement flowElement) { return Match.<FlowElement, Result<BpmnNode>>of() .<StartEvent>when(e -> e instanceof StartEvent, converterFactory.startEventConverter()::convert) .<EndEvent>when(e -> e instanceof EndEvent, converterFactory.endEventConverter()::convert) .<BoundaryEvent>when(e -> e instanceof BoundaryEvent, converterFactory.intermediateCatchEventConverter()::convertBoundaryEvent) .<IntermediateCatchEvent>when(e -> e instanceof IntermediateCatchEvent, converterFactory.intermediateCatchEventConverter()::convert) .<IntermediateThrowEvent>when(e -> e instanceof IntermediateThrowEvent, converterFactory.intermediateThrowEventConverter()::convert) .<Task>when(e -> e instanceof Task, converterFactory.taskConverter()::convert) .<Gateway>when(e -> e instanceof Gateway, converterFactory.gatewayConverter()::convert) .<SubProcess>when(e -> e instanceof SubProcess, converterFactory.subProcessConverter()::convertSubProcess) .<CallActivity>when(e -> e instanceof CallActivity, converterFactory.callActivityConverter()::convert) .<TextAnnotation>when(e -> e instanceof TextAnnotation, converterFactory.textAnnotationConverter()::convert) .<DataObjectReference>when(e -> e instanceof DataObjectReference, converterFactory.dataObjectConverter()::convert) .ignore(e -> e instanceof DataStoreReference, DataStoreReference.class) .ignore(e -> e instanceof DataObject, DataObject.class) .defaultValue(Result.ignored("FlowElement not found", getNotFoundMessage(flowElement))) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(flowElement) .value(); } FlowElementConverter(BaseConverterFactory converterFactory); } | FlowElementConverter extends AbstractConverter { public Result<BpmnNode> convertNode(FlowElement flowElement) { return Match.<FlowElement, Result<BpmnNode>>of() .<StartEvent>when(e -> e instanceof StartEvent, converterFactory.startEventConverter()::convert) .<EndEvent>when(e -> e instanceof EndEvent, converterFactory.endEventConverter()::convert) .<BoundaryEvent>when(e -> e instanceof BoundaryEvent, converterFactory.intermediateCatchEventConverter()::convertBoundaryEvent) .<IntermediateCatchEvent>when(e -> e instanceof IntermediateCatchEvent, converterFactory.intermediateCatchEventConverter()::convert) .<IntermediateThrowEvent>when(e -> e instanceof IntermediateThrowEvent, converterFactory.intermediateThrowEventConverter()::convert) .<Task>when(e -> e instanceof Task, converterFactory.taskConverter()::convert) .<Gateway>when(e -> e instanceof Gateway, converterFactory.gatewayConverter()::convert) .<SubProcess>when(e -> e instanceof SubProcess, converterFactory.subProcessConverter()::convertSubProcess) .<CallActivity>when(e -> e instanceof CallActivity, converterFactory.callActivityConverter()::convert) .<TextAnnotation>when(e -> e instanceof TextAnnotation, converterFactory.textAnnotationConverter()::convert) .<DataObjectReference>when(e -> e instanceof DataObjectReference, converterFactory.dataObjectConverter()::convert) .ignore(e -> e instanceof DataStoreReference, DataStoreReference.class) .ignore(e -> e instanceof DataObject, DataObject.class) .defaultValue(Result.ignored("FlowElement not found", getNotFoundMessage(flowElement))) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(flowElement) .value(); } FlowElementConverter(BaseConverterFactory converterFactory); Result<BpmnNode> convertNode(FlowElement flowElement); } | FlowElementConverter extends AbstractConverter { public Result<BpmnNode> convertNode(FlowElement flowElement) { return Match.<FlowElement, Result<BpmnNode>>of() .<StartEvent>when(e -> e instanceof StartEvent, converterFactory.startEventConverter()::convert) .<EndEvent>when(e -> e instanceof EndEvent, converterFactory.endEventConverter()::convert) .<BoundaryEvent>when(e -> e instanceof BoundaryEvent, converterFactory.intermediateCatchEventConverter()::convertBoundaryEvent) .<IntermediateCatchEvent>when(e -> e instanceof IntermediateCatchEvent, converterFactory.intermediateCatchEventConverter()::convert) .<IntermediateThrowEvent>when(e -> e instanceof IntermediateThrowEvent, converterFactory.intermediateThrowEventConverter()::convert) .<Task>when(e -> e instanceof Task, converterFactory.taskConverter()::convert) .<Gateway>when(e -> e instanceof Gateway, converterFactory.gatewayConverter()::convert) .<SubProcess>when(e -> e instanceof SubProcess, converterFactory.subProcessConverter()::convertSubProcess) .<CallActivity>when(e -> e instanceof CallActivity, converterFactory.callActivityConverter()::convert) .<TextAnnotation>when(e -> e instanceof TextAnnotation, converterFactory.textAnnotationConverter()::convert) .<DataObjectReference>when(e -> e instanceof DataObjectReference, converterFactory.dataObjectConverter()::convert) .ignore(e -> e instanceof DataStoreReference, DataStoreReference.class) .ignore(e -> e instanceof DataObject, DataObject.class) .defaultValue(Result.ignored("FlowElement not found", getNotFoundMessage(flowElement))) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(flowElement) .value(); } FlowElementConverter(BaseConverterFactory converterFactory); Result<BpmnNode> convertNode(FlowElement flowElement); } |
@Test public void testCreateNode() { assertTrue(tested.createNode("id").getContent().getDefinition() instanceof BPMNDiagramImpl); } | @Override protected Node<View<BPMNDiagramImpl>, Edge> createNode(String id) { return delegate.factoryManager.newNode(id, BPMNDiagramImpl.class); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected Node<View<BPMNDiagramImpl>, Edge> createNode(String id) { return delegate.factoryManager.newNode(id, BPMNDiagramImpl.class); } } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected Node<View<BPMNDiagramImpl>, Edge> createNode(String id) { return delegate.factoryManager.newNode(id, BPMNDiagramImpl.class); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected Node<View<BPMNDiagramImpl>, Edge> createNode(String id) { return delegate.factoryManager.newNode(id, BPMNDiagramImpl.class); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected Node<View<BPMNDiagramImpl>, Edge> createNode(String id) { return delegate.factoryManager.newNode(id, BPMNDiagramImpl.class); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } |
@Test public void testCreateProcessData() { assertNotNull(tested.createProcessData("id")); } | @Override public ProcessData createProcessData(String processVariables) { return new ProcessData(new ProcessVariables(processVariables)); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override public ProcessData createProcessData(String processVariables) { return new ProcessData(new ProcessVariables(processVariables)); } } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override public ProcessData createProcessData(String processVariables) { return new ProcessData(new ProcessVariables(processVariables)); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override public ProcessData createProcessData(String processVariables) { return new ProcessData(new ProcessVariables(processVariables)); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override public ProcessData createProcessData(String processVariables) { return new ProcessData(new ProcessVariables(processVariables)); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } |
@Test public void testCreateDiagramSet() { DiagramSet diagramSet = createDiagramSet(); assertNotNull(diagramSet); } | @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } |
@Test public void testGetDRGDiagramElement() { final DMNDiagramElement expected = mock(DMNDiagramElement.class); doReturn(expected).when(dmnDiagramsSessionState).getDRGDiagramElement(); final DMNDiagramElement actual = dmnDiagramsSession.getDRGDiagramElement(); assertEquals(expected, actual); } | public DMNDiagramElement getDRGDiagramElement() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagramElement).orElse(null); } | DMNDiagramsSession implements GraphsProvider { public DMNDiagramElement getDRGDiagramElement() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagramElement).orElse(null); } } | DMNDiagramsSession implements GraphsProvider { public DMNDiagramElement getDRGDiagramElement() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagramElement).orElse(null); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); } | DMNDiagramsSession implements GraphsProvider { public DMNDiagramElement getDRGDiagramElement() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagramElement).orElse(null); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } | DMNDiagramsSession implements GraphsProvider { public DMNDiagramElement getDRGDiagramElement() { return Optional.ofNullable(getSessionState()).map(DMNDiagramsSessionState::getDRGDiagramElement).orElse(null); } DMNDiagramsSession(); @Inject DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
final SessionManager sessionManager,
final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
final Map<String, Diagram> diagramsByDiagramElementId,
final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram(); } |
@Test public void testImports() { DiagramSet diagramSet = createDiagramSet(); Imports imports = diagramSet.getImports(); assertNotNull(imports); ImportsValue importsValue = imports.getValue(); assertNotNull(importsValue); List<DefaultImport> defaultImports = importsValue.getDefaultImports(); assertNotNull(defaultImports); assertFalse(defaultImports.isEmpty()); DefaultImport defaultImport = defaultImports.get(0); assertNotNull(defaultImport); assertEquals(getClass().getName(), defaultImport.getClassName()); } | @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } | RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader e, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(e.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(e.getPackage()), new ProcessType(e.getProcessType()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Imports(new ImportsValue(e.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(e.getSlaDueDate())); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); @Override ProcessData createProcessData(String processVariables); @Override AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes); } |
@Test public void testConvertEdges() { Task task1 = mockTask("1"); Task task2 = mockTask("2"); BpmnNode task1Node = mockTaskNode(task1); BpmnNode task2Node = mockTaskNode(task2); SequenceFlow sequenceFlow = mockSequenceFlow("seq1", task1, task2); List<BaseElement> elements = Arrays.asList(sequenceFlow, task1, task2); assertFalse(converterDelegate.convertEdges(parentNode, elements, new HashMap<>()).value()); Map<String, BpmnNode> nodes = new Maps.Builder<String, BpmnNode>().put(task1.getId(), task1Node).put(task2.getId(), task2Node).build(); assertTrue(converterDelegate.convertEdges(parentNode, elements, nodes).value()); } | Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } |
@Test public void testConvertEdgesIgnoredNonEdgeElement() { Map<String, BpmnNode> nodes = new HashMap<>(); List<BaseElement> elements = Arrays.asList(mockTask("1")); assertFalse(converterDelegate.convertEdges(parentNode, elements, nodes).value()); } | Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } | ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.composeResults(value, results); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); } |
@Test public void compose() { final Result result = ResultComposer.compose(value, result1, result2, result3); assertResult(result); } | @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } static Result composeResults(T value, Collection<Result<R>>... results); @SuppressWarnings("unchecked") static Result compose(T value, Result... result); } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } static Result composeResults(T value, Collection<Result<R>>... results); @SuppressWarnings("unchecked") static Result compose(T value, Result... result); } |
@Test public void composeList() { final Result result = ResultComposer.compose(value, result1, result2, result3); assertResult(result); } | @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } static Result composeResults(T value, Collection<Result<R>>... results); @SuppressWarnings("unchecked") static Result compose(T value, Result... result); } | ResultComposer { @SuppressWarnings("unchecked") public static <T> Result compose(T value, Result... result) { List<Result<Object>> results = Arrays.asList(result); return composeResults(value, results); } static Result composeResults(T value, Collection<Result<R>>... results); @SuppressWarnings("unchecked") static Result compose(T value, Result... result); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.