Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jubula-dev] Error with custom action for swing.JTextField

Hello!

Already very desperate, cause cannot make the custom action working and time is ticking :( ANY idea or advice is welcome, cause time is ticking for my thesis and I've spent already two weeks in attempts to just make the most simplest custom action to work :)

Have made my own component, that was supposed to extend TextComponent for swing (testing on SimpleAdder example) with additional action. For the beginning just trying to reuse existing VerifyText but with additional text parameter.

Component config sounds like following:

<compSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../org.eclipse.jubula.toolkit.common/resources/xml/ToolkitComponentConfiguration.xsd">

<configVersion>
<majorVersion>1</majorVersion>
<minorVersion>0</minorVersion>
</configVersion>

<toolkitComponent type="org.eclipse.jubula.rc.swing.TextField" visible="true">
<extends>javax.swing.text.JTextComponent</extends>
<testerClass>org.eclipse.jubula.rc.swing.tester.IfStatementTester</testerClass>
<action name="Statement.IfStatement.Text" >
<method>rcIfTextTest</method>
<param name="CompSystem.Text">
<type>java.lang.String</type>
</param>
<param name="CompSystem.Operator">
<type>java.lang.String</type>
<defaultValue>equals</defaultValue>
<valueSet>
<element name="CompSystem.Equals" value="equals"/>
<element name="CompSystem.NotEquals" value="not equals"/>
<element name="CompSystem.MatchesRegExp" value="matches"/>
<element name="CompSystem.SimpleMatch" value="simple match"/>
</valueSet>
</param>
<param name="Statement.Reference.TestCase">
<type>java.lang.String</type>
</param>
</action>
</toolkitComponent>
</compSystem>


The corresponding Adapter (very much alike in the examples):

public class ExtendedJTextCompAdapter implements IAdapterFactory {
    /** {@inheritDoc} */
    public Class[] getSupportedClasses() {
        return new Class[] { JTextComponent.class, JTextField.class };
    }

    /** {@inheritDoc} */
    public Object getAdapter(Class targetedClass, Object objectToAdapt) {
        if (targetedClass.isAssignableFrom(IComponent.class)) {

            IComponent returnvalue = null;
            if ((objectToAdapt instanceof JTextComponent) || (objectToAdapt instanceof JTextField)) {
                returnvalue = new JTextComponentAdapter(objectToAdapt);
            } 
            System.out.println("#### Adapter was called!");
            return returnvalue;
        }
        return null;
    }
}

and Tester:

public class IfStatementTester extends AbstractTextComponentTester {


public void rcIfTextTest(String text, String operator, String test_id)
{
this.rcVerifyText(text, operator);
}

}

What works:
 - can do own unbound_modules with this component/action
 - can actually add it as a new step manually and link it to TextComponent object, derived from AUT

What does not work:
 - When I use feature with my component in Jubula build - I can't make object mapping for TextComponents! Mouse over text fields start to spam me the error in the console (while labels for example can still be mapped). And when I do breakpoints in corresponding methods, mentioned in exception stack trace - debugger just ignores them. (also failed to run AutAgent manually in debug mode, so using embedded one)

 - When actually I use existing "technical components", and link them with my custom action - magic doesn't happen. And no error details are given or console output are present (neither in eclipse nor in embedded client/AUT log views nor in test result view). Just "Action error".

The error I get while trying to map text fields with my feature plugged into eclipse:

 AUT:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
AUT: at org.eclipse.jubula.rc.common.classloader.ImplClassClassLoader.implLoadClass(ImplClassClassLoader.java:91)
AUT: at org.eclipse.jubula.rc.common.classloader.ImplClassClassLoader.loadClass(ImplClassClassLoader.java:62)
AUT: at org.eclipse.jubula.rc.common.classloader.ImplClassClassLoader.loadClass(ImplClassClassLoader.java:107)
AUT: at org.eclipse.jubula.rc.common.AUTServerConfiguration.loadImplementationClass(AUTServerConfiguration.java:340)
AUT: at org.eclipse.jubula.rc.common.AUTServerConfiguration.createInstance(AUTServerConfiguration.java:292)
AUT: at org.eclipse.jubula.rc.common.AUTServerConfiguration.getImplementationClass(AUTServerConfiguration.java:238)
AUT: at org.eclipse.jubula.rc.swing.listener.MappingListener.handleEvent(MappingListener.java:115)
AUT: at org.eclipse.jubula.rc.swing.listener.AbstractAutSwingEventListener.eventDispatched(AbstractAutSwingEventListener.java:115)
AUT: at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2353)
AUT: at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2245)
AUT: at java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2203)
AUT: at java.awt.Component.dispatchEventImpl(Component.java:4612)
AUT: at java.awt.Container.dispatchEventImpl(Container.java:2143)
AUT: at java.awt.Component.dispatchEvent(Component.java:4544)
AUT: at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)
AUT: at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:910)
AUT: at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:568)
AUT: at java.awt.Component.dispatchEventImpl(Component.java:4586)
AUT: at java.awt.Container.dispatchEventImpl(Container.java:2143)
AUT: at java.awt.Component.dispatchEvent(Component.java:4544)
AUT: at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
AUT: at java.awt.SentEvent.dispatch(SentEvent.java:55)
AUT: at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:183)
AUT: at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:210)
AUT: at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:635)
AUT: at java.awt.Component.dispatchEventImpl(Component.java:4586)
AUT: at java.awt.Container.dispatchEventImpl(Container.java:2143)
AUT: at java.awt.Window.dispatchEventImpl(Window.java:2478)
AUT: at java.awt.Component.dispatchEvent(Component.java:4544)
AUT: at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
AUT: at java.awt.SequencedEvent.dispatch(SequencedEvent.java:101)
AUT: at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
AUT: at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
AUT: at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
AUT: at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
AUT: at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
AUT: at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
AUT: at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


At the same time, as I can see, the message for AUT, formed from my component/action, seems to be legit (at least in comparison with standard actions - everything seems to be filled in similar way).


Like I've told above - would be very thankful for any advice/comment or whatever else :) I've already out of any possible ideas how to move further and my deadline is coming closer and closer in the meanwhile :(

Thanks a lot in advance!

Best regards,
Sukhanov Egor


Back to the top