Bug 995534

Summary: Creating Service Test via tooling fails with NPE when project not yet built
Product: [JBoss] JBoss Fuse Service Works 6 Reporter: Brian Fitzpatrick <bfitzpat>
Component: SwitchYard EditorAssignee: Rob Cernich <rcernich>
Status: CLOSED CURRENTRELEASE QA Contact: lvaskova
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0 GACC: atangrin, kbabo, ldimaggi, soa-p-jira
Target Milestone: ER3   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brian Fitzpatrick 2013-08-09 16:20:42 UTC
Description of problem:
While testing quickstarts I discovered that the Create Service Test Class menu option fails with a NPE if a) the project hasn't been built yet or b) "Build Automatically" is turned off.

Version-Release number of selected component (if applicable):


How reproducible:
Every time

Steps to Reproduce:
1. Turn off "Build Automatically" (Project->Build Automatically)
2. Create a new SY project with a testable composite service
3. Right-click on the composite service and select "New Service Test Class" from popup menu (not available on button pad)
4. Click Finish

Actual results:
[1]
!ENTRY org.switchyard.tools.ui 4 0 2013-08-08 15:24:56.526
!MESSAGE Error resolving service interface.
!STACK 0
java.lang.NullPointerException
       at org.switchyard.extensions.java.JavaService.fromClass(JavaService.java:78)
       at org.switchyard.tools.ui.SwitchYardModelUtils.getServiceInterface(SwitchYardModelUtils.java:246)
       at org.switchyard.tools.ui.wizards.NewServiceTestClassWizardPage.resolveServiceType(NewServiceTestClassWizardPage.java:702)
       at org.switchyard.tools.ui.wizards.NewServiceTestClassWizardPage.createTypeMembers(NewServiceTestClassWizardPage.java:336)
       at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:2207)
       at org.switchyard.tools.ui.operations.CreateServiceTestOperation.execute(CreateServiceTestOperation.java:53)
       at org.switchyard.tools.ui.operations.AbstractSwitchYardProjectOperation.run(AbstractSwitchYardProjectOperation.java:117)
       at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
       at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
       at org.switchyard.tools.ui.wizards.NewServiceTestClassWizard$1.run(NewServiceTestClassWizard.java:73)
       at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

Expected results:
No error. Generated test class.

Additional info:

Comment 2 JBoss JIRA Server 2013-08-19 14:53:40 UTC
Brian Fitzpatrick <bfitzpat> made a comment on jira SWITCHYARD-1639

This may actually be resolved by the work done in SWITCHYARD-1654. Doing some checking now. Same area affected in SY Model Utils I believe.

Comment 3 JBoss JIRA Server 2013-08-19 15:07:34 UTC
Brian Fitzpatrick <bfitzpat> made a comment on jira SWITCHYARD-1639

Looks like that's the case. But now we're seeing a different issue when testing against the camel-mail-binding quickstart whether it's built or not built:

{code}
!ENTRY org.eclipse.graphiti.ui 4 0 2013-08-19 09:01:05.487
!MESSAGE GFCommandStack.execute(Command) java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:319)
	at org.eclipse.core.internal.runtime.AdapterManager.loadAdapter(AdapterManager.java:356)
	at org.switchyard.tools.ui.editor.diagram.CreateServiceTestCustomFeature.getResourceForInterface(CreateServiceTestCustomFeature.java:96)
	at org.switchyard.tools.ui.editor.diagram.CreateServiceTestCustomFeature.execute(CreateServiceTestCustomFeature.java:90)
	at org.eclipse.graphiti.features.custom.AbstractCustomFeature.execute(AbstractCustomFeature.java:83)
	at org.eclipse.graphiti.internal.command.GenericFeatureCommandWithContext.execute(GenericFeatureCommandWithContext.java:64)
	at org.eclipse.graphiti.internal.command.CommandContainer.execute(CommandContainer.java:81)
	at org.eclipse.graphiti.ui.internal.command.GefCommandWrapper.execute(GefCommandWrapper.java:51)
	at org.eclipse.graphiti.ui.internal.editor.EmfOnGefCommand.execute(EmfOnGefCommand.java:54)
	at org.eclipse.graphiti.internal.command.GFPreparableCommand2.doExecute(GFPreparableCommand2.java:37)
	at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
	at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
	at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
	at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:84)
	at org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execute(GFCommandStack.java:138)
	at org.eclipse.graphiti.ui.internal.action.CustomAction.executeOnCommandStack(CustomAction.java:65)
	at org.eclipse.graphiti.ui.internal.action.CustomAction.run(CustomAction.java:60)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
{code}

Comment 4 Rob Cernich 2013-08-26 19:28:28 UTC
The second issue was because the new test wizard did not accommodate inherited interfaces on composite service/references.  In addition to cleaning up the NPE, we will also try to resolve the inherited interface (i.e. the one defined on the promoted service/reference).

Comment 5 JBoss JIRA Server 2013-08-27 15:31:02 UTC
Keith Babo <kbabo> made a comment on jira SWITCHYARD-1639

pushed

Comment 9 JBoss JIRA Server 2014-06-16 23:51:04 UTC
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1639 to Closed