0

We have a service method which succesfully calls the WIM of the WAS. In this method we use the SDOHelper to create the RootDataObject and the ControlDataObject using the following (like described in the IBM docs):

DataObject root = SDOHelper.createRootDataObject();
DataObject controller = SDOHelper.createControlDataObject(root, null, SchemaConstants.DO_SEARCH_CONTROL);

For the implementing we added the com.ibm.websphere.org.eclipse.emf and org.eclipse.emf.ecore JARs to the class path with provided scope as it's part of the WAS. Our source compiles and works in the live enviroment.

Now I'll try to write test for this method. But I'll get NPE on the line to create the RootDataObject

java.lang.NullPointerException
  at org.eclipse.emf.ecore.sdo.util.SDOUtil.create(SDOUtil.java:579)
  at org.eclipse.emf.ecore.sdo.impl.EDataGraphImpl.createRootObject(EDataGraphImpl.java:523)
  at com.ibm.websphere.wim.util.SDOHelper.createRootDataObjectCache(SDOHelper.java:111)
  at com.ibm.websphere.wim.util.SDOHelper.createRootDataObject(SDOHelper.java:124)

But I don't know why or how I can avoid it to write a successfull test method

Any suggestions?

bish
  • 3,381
  • 9
  • 48
  • 69
  • Can you check whether the SDOHelper you have there is the class indeed? – Lajos Arpad Jul 14 '19 at 17:45
  • @LajosArpad Sry I don't understand you. What do you mean "there is the class indeed"? – bish Jul 15 '19 at 07:17
  • I mean that if you do not import the class, nothing stops you from naming your variables with the name of the class. In that case SDOHelper could be a variable, whose name matches the class name. It needs to have a createRootDataObject to even compile, but still, this is a possibility. – Lajos Arpad Jul 15 '19 at 13:11
  • Can you point to a sample recreate project maybe (with your pom)? – Scott Kurz Jul 16 '19 at 17:46

0 Answers0